00:20: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.

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

  • 20 Questions
  • Unlimited
  • System Management
    Services and User Management
    Security
    Automation, Orchestration, and Scripting
    Troubleshooting

Free Preview

This test is a free preview, no account required.
Subscribe to unlock all content, keep track of your scores, and access AI features!

Question 1 of 20

You are preparing a RHEL-based server that boots with GRUB 2 on a BIOS system. The kernel must always start with the noapic parameter, and the setting must be preserved when new kernels are installed. After making the change you will regenerate the boot-loader configuration with:

grub2-mkconfig -o /boot/grub2/grub.cfg

Which single configuration file should you edit before running the command so the new parameter is applied persistently?

  • /boot/grub2/custom.cfg

  • /etc/grub.d/10_linux

  • /boot/grub2/grub.cfg

  • /etc/default/grub

Question 2 of 20

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,ro /

  • mount -o bind,ro / /

  • mount -o remount,rw /

  • mount -o remount,nosuid /

Question 3 of 20

After cloning a Debian-based server to a replacement disk, the first reboot halts with an initramfs emergency prompt reporting that the kernel cannot mount the root filesystem on the UUID supplied in the root= parameter. Investigation shows that GRUB2 (installed in legacy BIOS/MBR mode) is still passing the old UUID to the kernel. The administrator wants to make the new root UUID persist across future kernel updates. Which configuration file should be modified before running update-grub so the correct root= value is passed to the kernel at every boot?

  • /etc/fstab

  • /etc/default/grub

  • /etc/grub.d/40_custom

  • /boot/grub/grub.cfg

Question 4 of 20

A Linux administrator is troubleshooting a server where a secondary XFS filesystem on /dev/sdb1 is suspected to be corrupt. The filesystem was not cleanly unmounted and now fails to mount. Before attempting any repairs, the administrator needs to perform a read-only check of the filesystem to assess the damage without making any modifications. Which of the following commands should be used to accomplish this?

  • xfs_repair -n /dev/sdb1

  • xfs_repair /dev/sdb1

  • xfs_growfs /dev/sdb1

  • fsck /dev/sdb1

Question 5 of 20

A system administrator is running a script that generates a large amount of verbose output to both standard output and standard error. The administrator only needs to check the script's exit code and wants to prevent all output from being displayed on the terminal or written to a log file. Which of the following commands will achieve this?

  • script.sh > /dev/random

  • script.sh > /dev/zero

  • script.sh | /dev/null

  • script.sh > /dev/null 2>&1

Question 6 of 20

You need to permanently disable IPv6 on a BIOS-based RHEL server that uses GRUB 2. The change must survive future kernel updates and must follow the vendor-recommended workflow for modifying the boot loader configuration. Which action will achieve this goal?

  • Add "ipv6.disable=1" to the GRUB_CMDLINE_LINUX line in /etc/default/grub and run "grub2-mkconfig -o /boot/grub2/grub.cfg".

  • Append "ipv6.disable=1" directly to the linux line in /boot/grub2/grub.cfg and save the file.

  • Add "ipv6.disable=1" to the DEFAULTKERNEL variable in /etc/sysconfig/kernel and run "dracut -f" to rebuild the initramfs.

  • Create a custom menuentry with "ipv6.disable=1" inside /etc/grub.d/40_custom and run "grubby --update-kernel=ALL".

Question 7 of 20

A system administrator is teaching a new intern about the Filesystem Hierarchy Standard (FHS) on a Linux server. The intern asks about the purpose of the topmost directory. According to the FHS, what is the primary role of the root (/) directory?

  • It contains variable data files that change during system operation, such as logs and mail spools.

  • It contains the majority of multi-user utilities, applications, and their libraries.

  • It serves as the primary hierarchy and contains all other directories and files.

  • It contains all system-wide configuration files and host-specific settings.

Question 8 of 20

A network administrator is using iperf3 to troubleshoot network throughput between two Linux servers, ServerA (10.0.1.10) and ServerB (10.0.1.20). The administrator starts the iperf3 server process on ServerA. To measure the download speed from ServerA to ServerB, which command should be executed on ServerB?

  • iperf3 -s -c 10.0.1.10

  • iperf3 -c 10.0.1.10 --get-server-output

  • iperf3 -c 10.0.1.10

  • iperf3 -c 10.0.1.10 -R

Question 9 of 20

You are writing a Bash deployment script that must append the following stanza to /etc/httpd/conf.d/example.conf:

<VirtualHost *:80>
    ServerName $SERVERNAME
    DocumentRoot $DOCROOT
</VirtualHost>

The script has two requirements:

  • The $SERVERNAME and $DOCROOT variables must be substituted by the parent shell before the text is written.
  • The four leading spaces that indent each inner line are literal spaces and must be preserved exactly as written.

Which of the following command constructions meets both requirements and appends the stanza to the file?

  • cat <> /etc/httpd/conf.d/example.conf <VirtualHost *:80> ServerName $SERVERNAME DocumentRoot $DOCROOT EOF

  • cat <<'EOF' >> /etc/httpd/conf.d/example.conf <VirtualHost *:80> ServerName $SERVERNAME DocumentRoot $DOCROOT EOF

  • cat <<< "<VirtualHost *:80> ServerName $SERVERNAME DocumentRoot $DOCROOT " >> /etc/httpd/conf.d/example.conf

  • cat <<-EOF >> /etc/httpd/conf.d/example.conf <VirtualHost *:80> ServerName $SERVERNAME DocumentRoot $DOCROOT EOF

Question 10 of 20

A Linux administrator has placed a new set of custom scripts in the /usr/local/sbin directory and made them executable. When the administrator tries to run a script by typing only its name, the shell returns a "command not found" error. The output of echo $PATH is as follows:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Which of the following commands must the administrator run to allow the scripts in /usr/local/sbin to be executed by name for the duration of the current session?

  • source /usr/local/sbin

  • chmod +x /usr/local/sbin/*

  • export PATH=$PATH:/usr/local/sbin

  • export PATH="/usr/local/sbin"

Question 11 of 20

A system administrator is running a lengthy script, ./update.sh, that generates important progress information to standard output. The administrator needs to capture this output in a file named update.log for later analysis, but also wants to monitor the script's execution in real time on the terminal. Which of the following commands will achieve this?

  • ./update.sh | tee update.log

  • ./update.sh > update.log && tail -f update.log

  • ./update.sh > update.log

  • tee update.log < ./update.sh

Question 12 of 20

During installation of a new x86_64 server, the root filesystem is placed inside a LUKS-encrypted logical volume (LVM). After running dracut to regenerate the initial RAM disk, the machine boots successfully and asks for the passphrase early in the boot sequence. Which statement best explains why the initramfs stage is mandatory for this setup?

  • It supplies the user-space tools and kernel modules needed to unlock the LUKS container and activate the LVM so the kernel can mount the real root filesystem.

  • It contains the systemd unit files that start normal services after the kernel boots into the real root filesystem.

  • It provides firmware code that lets the BIOS or UEFI locate and launch the bootloader on the disk.

  • It allows GRUB2 to read /etc/default/grub from the encrypted disk and rebuild the boot menu on every startup.

Question 13 of 20

A system administrator is analyzing disk usage on a Linux server and observes that the /usr directory consumes a significant amount of space. According to the Filesystem Hierarchy Standard (FHS), what is the primary purpose of this directory?

  • It contains the personal directories for all non-root users on the system.

  • It contains host-specific system configuration files and various shell scripts.

  • It contains sharable, read-only data, including the majority of user utilities and applications.

  • It contains variable data files, such as system logs, mail spools, and printer queues.

Question 14 of 20

You are hardening a Linux server that sometimes remounts its root filesystem read-only during maintenance. A health-check script must confirm at runtime that /tmp is really mounted with the noexec flag, even if /etc/mtab is unavailable or out of date. Which single file should the script read to obtain an authoritative, up-to-date list of all mounts and their current options?

  • /run/mount/utab

  • /etc/fstab

  • /proc/partitions

  • /proc/mounts

Question 15 of 20

A security scan reveals that the /tmp directory on a multi-user Linux server has permissions drwxrwxrwx (0777). To bring the directory back into compliance with the Filesystem Hierarchy Standard (FHS) and ensure that ordinary users cannot delete files they do not own, which chmod command should the administrator run?

  • chmod 0777 /tmp

  • chmod 2777 /tmp

  • chmod 1777 /tmp

  • chmod 755 /tmp

Question 16 of 20

A system administrator needs to permanently add the nomodeset kernel parameter to the GRUB 2 boot-loader configuration. Which of the following methods should the administrator use to ensure the change persists after a kernel update?

  • Add the line kernel.nomodeset=1 to the /etc/sysctl.conf file and run sysctl -p.

  • Directly edit the /boot/grub/grub.cfg file and add the parameter to the linux line.

  • Edit the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub and then run update-grub.

  • Append nomodeset to the end of the /proc/cmdline file.

Question 17 of 20

During an overnight maintenance window you plan to shrink the ext4 file system located on /dev/mapper/vgdata-lvarchive. Before reducing the size of the underlying logical volume, you need to know exactly how many file-system blocks the volume can be reduced to so that you do not make it smaller than the data it contains. The file system is currently unmounted, and you want a command that only reports this minimum size without modifying anything. Which single command satisfies this requirement?

  • resize2fs -M /dev/mapper/vgdata-lvarchive

  • resize2fs -f /dev/mapper/vgdata-lvarchive

  • e2fsck -f /dev/mapper/vgdata-lvarchive

  • resize2fs -P /dev/mapper/vgdata-lvarchive

Question 18 of 20

During a compliance audit on an x86_64 server running a 6.x Linux kernel, you list the contents of /boot and see the following files:

/boot/initramfs-6.7.9-amd64.img
/boot/vmlinuz-6.7.9-amd64
/boot/System.map-6.7.9-amd64
/boot/grub/grub.cfg

The auditors ask you to justify the presence of the initramfs-6.7.9-amd64.img file. Which statement accurately describes the purpose of this file in the Linux boot process?

  • It is a sector map generated by LILO that tells the bootloader where kernel sectors are located on disk.

  • It provides a minimal root filesystem loaded into RAM so the kernel can load drivers and scripts required to mount the real root filesystem before normal boot continues.

  • It is the main GRUB2 configuration file that lists available boot entries and kernel parameters.

  • It is a compressed copy of the kernel that the firmware expands before handing control to the bootloader.

Question 19 of 20

During a new Linux deployment you create a separate logical volume for user data so the operating system can be re-installed without touching personal files. According to the Filesystem Hierarchy Standard (FHS), to which top-level directory should you mount this volume so that each user's dotfiles and other personal data are found automatically by shells, desktop environments, and standard tools without any extra configuration?

  • /opt

  • /usr/local

  • /srv

  • /home

Question 20 of 20

A Linux system administrator needs to modify the system-wide configuration for network services on a server. According to the Filesystem Hierarchy Standard (FHS), in which directory should the administrator primarily look for these configuration files?

  • /boot

  • /home

  • /etc

  • /var