00:15:00

CompTIA Linux+ Practice Test (XK0-006)

Use the form below to configure your CompTIA Linux+ Practice Test (XK0-006). The practice test can be configured to only include certain exam objectives and domains. You can choose between 5-100 questions and set a time limit.

Logo for CompTIA Linux+ XK0-006 (V8)
Questions
Number of questions in the practice test
Free users are limited to 20 questions, upgrade to unlimited
Seconds Per Question
Determines how long you have to finish the practice test
Exam Objectives
Which exam objectives should be included in the practice test

CompTIA Linux+ XK0-006 (V8) Information

CompTIA Linux+ (v8 / XK0-006) Exam

The CompTIA Linux+ (XK0-006) certification is designed for IT professionals who work with Linux systems. It validates skills in system administration, security, scripting, and troubleshooting. This certification is vendor-neutral, covering multiple distributions such as Ubuntu, CentOS, and Red Hat.

Exam Overview

The XK0-006 exam consists of a maximum of 90 questions, including multiple-choice and performance-based questions. Candidates have 90 minutes to complete the test. The exam costs $358 USD. A passing score is 720 on a scale of 100 to 900. The certification is valid for three years and can be renewed through CompTIA’s continuing education program.

Exam Content

The XK0-006 exam focuses on five main domains: system management, security, scripting and automation, troubleshooting, and Linux fundamentals. System management includes package management, system monitoring, and user administration. Security covers permissions, authentication, and encryption. Scripting and automation focus on Bash scripting and task automation. Troubleshooting tests problem-solving skills for system failures and performance issues. Linux fundamentals include file system hierarchy, networking, and command-line operations.

Who Should Take This Exam?

The CompTIA Linux+ certification is ideal for system administrators, Linux support technicians, and DevOps professionals. It is recommended for individuals with at least one year of Linux experience. This certification is beneficial for IT professionals working with servers, cloud infrastructure, and cybersecurity.

How to Prepare

Candidates should review the official CompTIA Linux+ Exam Objectives and study materials provided by CompTIA. Hands-on experience with Linux systems is essential. Practice exams can help assess readiness and identify weak areas. Using Linux in a lab or virtual environment can provide practical experience with commands, system configuration, and troubleshooting.

Summary

The CompTIA Linux+ (XK0-006) certification is a valuable credential for IT professionals working with Linux systems. It validates essential skills in system administration, security, and automation. This certification is ideal for those managing Linux-based environments in IT infrastructure, cybersecurity, and cloud computing.

Free CompTIA Linux+ XK0-006 (V8) Practice Test

Press start when you are ready, or press Change to modify any settings for the practice test.

  • Questions: 15
  • Time: Unlimited
  • Included Topics:
    System Management
    Services and User Management
    Security
    Automation, Orchestration, and Scripting
    Troubleshooting
Question 1 of 15

A Linux administrator needs to manage KVM-based virtual machines on a headless server. The administrator must use a command-line tool to interact with the libvirt daemon to list all virtual machines, including those that are currently shut down. Which of the following commands would accomplish this task?

  • virt-manager --list-all

  • libvirtd list vms

  • qemu-img info --all

  • virsh list --all

Question 2 of 15

A developer needs to merge two configuration files, app.conf.old and app.conf.new, into a single file named app.conf. They want to interactively review the differences side-by-side and choose which version of each differing line to include in the final output file. Which of the following commands will achieve this?

  • cp app.conf.old app.conf && sdiff --in-place app.conf app.conf.new

  • sdiff app.conf.old app.conf.new | merge app.conf

  • diff -u app.conf.old app.conf.new > app.conf

  • sdiff -o app.conf app.conf.old app.conf.new

Question 3 of 15

A Linux administrator maintains a Bash script that parses a 10 GB web-server log. Profiling with time and strace shows that almost all CPU time is spent inside a while read line; do …; done loop that uses only simple shell built-ins. The administrator consults an AI code assistant for ways to make the script run much faster with minimal changes. Which recommendation would provide the GREATEST reduction in run time?

  • Use the Bash builtin mapfile -t to load the file into an array before processing it in the script.

  • Run the script with nice -n -5 to give it higher CPU scheduling priority.

  • Remount the filesystem containing the log with the noatime option before running the script.

  • Replace the entire while read loop with a single awk command that performs the same parsing in one pass.

Question 4 of 15

A system administrator needs to quickly document the storage layout of a new Linux server. They require a command that displays all block devices, including physical disks, partitions, and logical volumes, in a clear, hierarchical format to easily visualize their relationships. Which of the following commands is the most suitable for this specific task?

  • lsblk

  • fdisk -l

  • parted -l

  • blkid

Question 5 of 15

During a security-hardening exercise, you are asked to configure a service account's Bash environment so that users can still recall commands in the current session, but no history is ever written to ~/.bash_history when they log out. Which Bash environment variable should you unset or set to an empty value in the account's shell profile to meet this requirement?

  • HISTFILESIZE

  • HISTSIZE

  • HISTCONTROL

  • HISTFILE

Question 6 of 15

A systems administrator is configuring secure remote access for a user who only needs to transfer files. The administrator modifies the /etc/ssh/sshd_config file, setting Subsystem sftp to internal-sftp and adding a Match User block with a ChrootDirectory directive pointing to the user's home directory (%h). After restarting the SSH daemon, the user's SFTP connection is immediately closed after successful authentication. Which of the following is the most likely cause for this failure?

  • The sftp-server binary has not been copied into the chroot jail.

  • The user's assigned shell, /bin/bash, is not present within the chroot jail.

  • A firewall is blocking incoming connections for the SFTP service.

  • The ownership and permissions on the ChrootDirectory path are incorrect.

Question 7 of 15

An administrator needs to capture only HTTPS traffic for later analysis. The capture must:

  • Listen on interface eth0
  • Record only TCP traffic whose source or destination port is 443
  • Disable hostname and service-name resolution to reduce overhead
  • Store the packets in a file named capture.pcap rather than printing them to the screen

Which tcpdump command satisfies all of these requirements?

  • tcpdump -i eth0 -n tcp port 443 -w capture.pcap

  • tcpdump -i eth0 -nn tcp port 443 -w capture.pcap

  • tcpdump -i eth0 -nn udp port 443 -w capture.pcap

  • tcpdump -i eth0 -nn tcp port 443 -r capture.pcap

Question 8 of 15

Your DevOps team uses AI-assisted generators to create Python helper scripts for Linux automation. To meet the code-linting best practice and prevent any commit that violates PEP 8 or introduces obvious logical errors from reaching the shared repository, you need an automated safeguard that still lets developers review their changes locally. Which approach BEST satisfies this requirement?

  • Use git rebase with the --squash option to condense AI-generated commits before merging.

  • Require all commits to be GPG-signed so the author can be verified by reviewers.

  • Enable Git Large File Storage (LFS) for the repository and review code style after each push.

  • Configure a Git pre-commit hook that runs pylint and black, blocking the commit if violations are detected.

Question 9 of 15

A development team is evaluating whether a new backup utility qualifies as free software under the Free Software Foundation (FSF) definition. The utility's license permits commercial and non-commercial redistribution of unchanged binaries, but it forbids sharing modified versions unless the original author grants written permission. According to the FSF's four essential software freedoms, which specific freedom does this restriction violate, causing the utility to fail the free-software test?

  • The freedom to distribute copies of your modified versions to others.

  • The freedom to study how the program works and modify it for private use.

  • The freedom to run the program as you wish, for any purpose.

  • The freedom to redistribute unchanged copies of the program to anyone.

Question 10 of 15

You have booted a Linux server into single-user (rescue) mode after an unexpected power loss. Before you run fsck on the root file system (/), you must switch that file system to read-only without changing its mount point or rebooting. Which single command accomplishes this task?

  • mount -o remount,nosuid /

  • mount -o remount,ro /

  • mount -o bind,ro / /

  • mount -o remount,rw /

Question 11 of 15

Users report that a ticket-tracking web application hosted on a single Linux server becomes noticeably sluggish during peak usage. While the slowdown is in progress, you capture the following statistics on the 4-core host:

top (14:18:07)
%Cpu(s):  3.7 us,  1.1 sy,  0.0 ni,  0.1 id, 94.6 wa,  0.5 hi,  0.0 si,  0.0 st

iostat -dx 5
Device:            r/s     w/s    rkB/s   wkB/s rrqm/s wrqm/s %util
nvme0n1          18.4   773.2    962.7  7879.3    0.0    0.1  99.4

vmstat 5
procs  -----------memory--------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd  free  buff  cache   si  so    bi   bo   in   cs us sy id wa st
 1  3     0  12472 13004 2219644  0   0    130 1702 1020 2020  4  1  0 94  0

Which change is most likely to improve the page-load latency without modifying application code?

  • Aggregate two NICs in an 802.3ad (LACP) bond to increase available network bandwidth.

  • Lower the primary interface's MTU from 1500 to 1400 bytes to avoid packet fragmentation.

  • Raise the vm.swappiness value so the kernel pages inactive memory sooner.

  • Move the application's database and log files to faster storage (for example, an SSD array or dedicated NVMe device).

Question 12 of 15

Your monitoring team reports that large HTTPS file transfers keep failing after traffic is routed through a site-to-site IPSec VPN. A packet capture shows the server sending 1500-byte Ethernet frames while the VPN gateway returns ICMP "fragmentation needed" messages. Before changing any interface settings, you need to discover the largest packet that can traverse the entire path without fragmentation from the Linux server. Which command will let you verify that maximum unfragmented size?

  • ethtool -S eth0 | grep drop to look for oversized-frame counters

  • ss -lnt | awk '{print $2}' to view MSS values on listening sockets

  • ip link set dev eth0 mtu 1400 && ping -c 4 203.0.113.10 to see if packets pass afterward

  • ping -c 4 -M do -s 1472 203.0.113.10 and adjust the -s value downward until the echoes succeed

Question 13 of 15

A junior administrator writes the following line in a Bash script to capture the first log file created on the current date that is stored inside a compressed archive:

BACKUP_DIR=`tar -tzf backup.tar.gz | grep "\`date +%F\`" | head -1`

The script fails with a "command not found" error because the inner backticks are parsed too early. Which rewritten command follows POSIX-compliant best practice for nested command substitution and eliminates the escaping problem?

  • BACKUP_DIR=tar -tzf backup.tar.gz | grep "$(date +%F)" | head -1

  • BACKUP_DIR=$(tar -tzf backup.tar.gz | grep date +%F | head -1)

  • BACKUP_DIR=tar -tzf backup.tar.gz | grep "\date +%F`" | head -1 | tr -d '\n'`

  • BACKUP_DIR=\((tar -tzf backup.tar.gz | grep "\)(date +%F)" | head -1)

Question 14 of 15

An administrator is migrating an iptables DNAT rule to nftables. The existing rule is

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j DNAT --to-destination 192.168.1.20:8443

The ip family nat table and its prerouting chain already exist. Which single nft command recreates the same destination NAT behavior?

  • nft add rule ip filter input iif "eth0" tcp dport 443 redirect to 192.168.1.20:8443

  • nft add rule ip nat postrouting oif "eth0" tcp dport 443 dnat to 192.168.1.20:8443

  • nft add rule ip nat prerouting oif "eth0" tcp dport 443 snat to 192.168.1.20:8443

  • nft add rule ip nat prerouting iif "eth0" tcp dport 443 dnat to 192.168.1.20:8443

Question 15 of 15

A systems administrator on a Debian-based server discovers that the package management system is in a broken state after a software installation was abruptly terminated. When attempting to install new packages using apt, the system reports errors related to unmet dependencies. Which of the following commands should the administrator run to attempt to correct the broken dependencies and fix the package cache?

  • sudo apt-get autoremove

  • sudo apt --fix-broken install

  • sudo dpkg --configure -a

  • sudo apt-get update