CompTIA certification · Exam XK0-006

XK0-006 Mock Exam

CompTIA Linux+ V8

Free XK0-006 questions on System Management, each with the answer and an explanation.

20 questions · 21 minutes · free, no sign-up

System Management questions

1–10 of 13 free
Question 1 Choose 1
A Linux systems administrator is running an important maintenance task that consumes a large amount of CPU, causing other applications to slow. Which of the following actions should the administrator take to help alleviate the issue?
Show answerHide answer

Correct answer: B Lower the priority of the maintenance task with renice.

Explanation

Explanation:

The renice command allows an administrator to alter the scheduling priority of an already running process.

The Concept of "Niceness": In Linux, process priority is represented by a "nice" value, ranging from -20 (highest priority) to 19 (lowest priority).

Alleviating CPU Contention: By increasing the nice value of the CPU-heavy maintenance task (e.g., changing it from 0 to 10), the administrator tells the kernel's scheduler to give that task less CPU time when other processes need it.

Impact on Other Apps: This effectively "lowers the priority" of the maintenance task, allowing the other applications to receive the CPU cycles they need to remain responsive.

Explanation of Incorrect Answers

Increase the available CPU time with pidstat:
pidstat is a monitoring tool used to report statistics for Linux tasks (CPU, memory, I/O).
It is used for observation and diagnosis, not for modifying process behavior or increasing CPU allocation.

Run the maintenance task with nohup:
nohup (no hangup) is used to run a command so that it continues running even after the user logs out.
It does not affect CPU usage or process priority; its only purpose is to ignore the SIGHUP signal.

Execute the other applications with the bg utility:
The bg (background) utility is used to resume a suspended job in the background.
Moving a process to the background does not change its priority or CPU consumption; it simply frees up the terminal's foreground for other commands.

Reference
CompTIA Exam Objective: Domain 1.0 (System Management) – Subsection 1.1: "Summarize and utilize Linux command line tools" and Domain 5.0 (Troubleshooting) – Subsection 5.1: "Analyze and troubleshoot system-level issues" (specifically Process Management).
Reference: Linux Man Pages (man renice, man nice); Official CompTIA Linux+ Study Guide, Chapter on Process and Resource Management.
Question 2 Choose 1
A systems administrator needs to set the IP address of a new DNS server. Which of the following files should the administrator modify to complete this task?
Show answerHide answer

Correct answer: B /etc/resolv.conf

Explanation

Explanation:

The /etc/resolv.conf file is the primary configuration file for system DNS resolution. It specifies which DNS name servers the system should use for domain name resolution.

What /etc/resolv.conf does:
Defines the DNS servers (name servers) that the system queries
Sets search domains for hostname lookups
Configures resolver options and behavior
Read by the system's resolver library for all DNS queries

Typical /etc/resolv.conf content:
# Specify DNS servers (IP addresses)
nameserver 192.168.1.100
nameserver 8.8.8.8
nameserver 8.8.4.4

# Search domain for unqualified hostnames
search example.com lab.example.com

# Options
options timeout:2 attempts:3

To set the IP address of a new DNS server, the administrator would add or modify a line like:
nameserver 192.168.1.53

Why other options are incorrect:

❌ /etc/whois.conf
Purpose: Configuration file for the whois command
Function: Maps whois servers to specific domain extensions
Limitation: Only affects the whois client command, not system-wide DNS resolution
Rarely used and unrelated to system DNS configuration

❌ /etc/nsswitch.conf
Purpose: Name Service Switch configuration file
Function: Determines the order of sources for various system databases (hosts, passwd, group, services)
Limitation: Controls which services are queried (files, dns, ldap, etc.), not where the DNS servers are
Example entry: hosts: files dns - this tells the system to check /etc/hosts first, then DNS
Does NOT contain DNS server IP addresses

❌ /etc/dnsmasq.conf
Purpose: Configuration file for dnsmasq (DNS forwarder/DHCP server service)
Function: Configures the dnsmasq service if installed and running
Limitation: Only relevant if the system runs dnsmasq as a local DNS server
Even with dnsmasq, the system's resolver still uses /etc/resolv.conf (often pointing to localhost)
This is service-specific, not the system-wide resolver configuration

Reference:
man 5 resolv.conf - The manual page for resolv.conf format
The resolver is part of glibc and reads this file
Changes to /etc/resolv.conf take effect immediately for new connections
Question 3 Choose 1
Which of the following best describes journald?
Show answerHide answer

Correct answer: A A system service that collects and stores logging data

Explanation

Explanation:

journald is part of the systemd suite. It is a daemon that collects, stores, and manages log data from the kernel, system services, and user applications.
Logs are stored in a binary journal format, which can be queried using the journalctl command.
This provides centralized, structured logging, making it easier to filter, search, and analyze system events.

Why the Other Options Are Wrong

A feature that creates crash dumps in case of kernel failure → That’s handled by kdump, not journald.
A service responsible for keeping the filesystem journal → That’s part of the filesystem itself (e.g., ext4 journaling), not journald.
A service responsible for writing audit records to a disk → That’s the role of auditd, not journald.

Reference:
Systemd documentation: journald is the logging service that stores logs in binary format and integrates with journalctl for querying.
CompTIA Linux+ XK0-006 Exam Objectives: Log Management and Monitoring (Domain: Security).
Question 4 Choose 1
Which of the following filesystems contains non-persistent or volatile data?
Show answerHide answer

Correct answer: C /proc

Explanation

Explanation:

The /proc directory is a pseudo-filesystem (often called a virtual filesystem) that serves as an interface to the Linux kernel and process information.

Non-Persistent/Volatile:
The data within /proc does not exist on any physical disk. Instead, it is generated "on the fly" by the kernel in the system's RAM.

System State:
It contains information about currently running processes (organized by PID) and hardware configuration (e.g., /proc/cpuinfo, /proc/meminfo).

Volatility:
Because it exists only in memory, all data in /proc is lost instantly when the system is powered down or rebooted.

Explanation of Incorrect Answers

/boot:
This directory contains the files needed to start the system, such as the Linux kernel, initramfs, and the GRUB bootloader configuration. This data is persistent and must be stored on a physical disk (usually a dedicated partition) to be available during the power-on self-test (POST) and boot process.

/usr:
The /usr (Unix System Resources) directory contains the majority of user utilities and applications (e.g., /usr/bin, /usr/lib). This is a read-only, persistent filesystem that holds static data installed by the package manager.

/var:
The /var directory is used for variable data that changes during system operation, such as logs (/var/log), mail, and print spools. While the data inside changes frequently, the directory itself is persistent and resides on a physical disk so that logs are preserved across reboots for troubleshooting.

Reference:
CompTIA Exam Objective: Domain 1.0 (System Management) – Subsection 1.1: "Summarize and utilize Linux command line tools" and "Manage the filesystem hierarchy."
Reference: Filesystem Hierarchy Standard (FHS); Official CompTIA Linux+ Study Guide, Chapter on Filesystem Management and Hierarchy.
Question 5 Choose 1
Which of the following best describes the role of initrd?
Show answerHide answer

Correct answer: B It contains basic kernel modules and drivers required to start the system.

Explanation

Explanation:

initrd (initial ramdisk) or initramfs (initial RAM filesystem) is a temporary filesystem used by the Linux kernel during the boot process before the real root filesystem is mounted. Its primary role is to provide essential modules and drivers needed to access the actual root filesystem.

What initrd/initramfs does:
Purpose:
Loads necessary drivers for hardware that isn't built directly into the kernel
Provides modules for storage controllers (SATA, SCSI, NVMe)
Contains filesystem drivers (ext4, XFS, Btrfs) to mount the real root
Includes LVM, RAID, or encryption modules if the root is on such volumes
Performs early userspace setup before switching to the real root

Boot process with initrd:
1. BIOS/UEFI → Bootloader (GRUB)
2. Bootloader loads kernel and initrd into memory
3. Kernel decompresses and starts, mounts initrd as temporary root
4. Kernel runs /init from initrd
5. initrd loads necessary modules and drivers
6. initrd mounts the real root filesystem
7. initrd performs pivot_root to switch to real root
8. Real init system (systemd) takes over

When initrd is essential:
Root on LVM: Needs LVM modules to activate volume groups
Root on encrypted disk: Needs crypto modules to unlock the drive
Root on network: Needs network drivers for NFS root
Root on uncommon hardware: Needs drivers for specialized storage controllers
Root on RAID: Needs MD RAID modules to assemble arrays

Why other options are incorrect:

❌ It is required to connect to the system via SSH.
SSH connectivity is managed by the SSH daemon (sshd) which runs AFTER the system has fully booted
SSH requires network configuration, which happens in the main system, not during early boot
initrd is long gone by the time SSH is available
SSH has nothing to do with the initial hardware detection and root mounting phase

❌ It contains trusted certificates and secret keys of the system.
Certificates and keys are typically stored in /etc/ssl/certs or /etc/ssh/ on the root filesystem
These are security credentials for services, not boot components
initrd is temporary and not designed for persistent secret storage
Some specific setups (like disk encryption) might include keys in initrd, but this is not its primary purpose

❌ It is required to initialize a random device within a Linux system.
The random device (/dev/random, /dev/urandom) is provided by the kernel, not initrd
Random number generation is a kernel feature that initializes independently
Some early boot entropy gathering might occur, but this is not the role of initrd

Reference:
initrd = Initial RAM Disk
initramfs = Initial RAM Filesystem (modern replacement)
Required when kernel lacks built-in drivers for boot hardware
Created by tools like mkinitramfs (Debian) or dracut (RHEL/Fedora)
Without initrd, the kernel would need every possible driver compiled in, making the kernel huge
Question 6 Choose 1
A Linux administrator wants to add a user to the Docker group without changing the user’s primary group.
Which of the following commands should the administrator use to complete this task?
Show answerHide answer

Correct answer: C sudo usermod -aG docker user

Explanation

Explanation:

To add a user to a supplementary group like docker without affecting their primary group, the -a (append) and -G (groups) flags are required. The -a flag is critical because it ensures the user is added to the new group while remaining a member of all their current secondary groups. Without it, the user would be removed from any other existing secondary groups.

Why other options are incorrect

❌ sudo groupmod docker user:
The groupmod command is used to modify the properties of the group itself (such as its name or GID), not to manage user membership within that group.

❌ sudo usermod -g docker user:
The lowercase -g flag changes the user's primary group. This would violate the requirement to add the user to the group without changing their primary group assignment.

❌ sudo groupmod -G docker user:
The groupmod command does not support a -G flag for adding users. As mentioned, this utility is intended for group metadata, not membership administration.
Question 7 Choose 1
A Linux administrator tries to install Ansible in a Linux environment. One of the steps is to change the owner and the group of the directory /opt/Ansible and its contents. Which of the following commands will accomplish this task?
Show answerHide answer

Correct answer: B chown -R Ansible:Ansible /opt/Ansible

Explanation

Explanation:

The chown (change owner) command is the primary tool used to modify the ownership of files and directories.

Ansible:Ansible: This syntax defines both the owner and the group simultaneously. The first "Ansible" refers to the user account, and the second "Ansible" (following the colon) refers to the group name.

-R (Recursive): This flag is the most critical part of the requirement to change the owner of the directory and its contents. It ensures the ownership changes are applied to all subdirectories and files within /opt/Ansible.

/opt/Ansible: This is the target directory path being modified.

Explanation of Incorrect Answers
groupmod -g Ansible -n /opt/Ansible:
The groupmod command is used to modify group definitions (such as changing the Group ID or the group's name). It does not change the ownership of files or directories.

usermod -aG Ansible /opt/Ansible:
The usermod command is used to modify user accounts. This specific command would attempt to add a user to a group, but the syntax is incorrect as it uses a directory path (/opt/Ansible) where a username should be.

chmod -c /opt/Ansible:
The chmod command changes permissions (read, write, execute), not ownership. The -c flag stands for "changes," which outputs a diagnostic message for every file processed, but it does not address the requirement to change the owner and group.

Reference
CompTIA Exam Objective: Domain 1.0 (System Management) – Subsection 1.1: "Configure and manage software and kernel modules" (specifically File and Directory Permissions/Ownership).
Reference: Linux Man Pages (man chown); Official CompTIA Linux+ Study Guide, Chapter on File and Directory Management.
Question 8 Choose 1
Which of the following describes the method of consolidating system events to a single location?
Show answerHide answer

Correct answer: A Log aggregation

Explanation

Explanation:

Log aggregation is the process of collecting system events and logs from multiple sources (applications, servers, containers, network devices) and consolidating them into a single location.

This makes it easier to:
* Monitor system health.
* Detect anomalies or security incidents.
* Perform centralized analysis and troubleshooting.

Tools like ELK Stack (Elasticsearch, Logstash, Kibana), Splunk, or Graylog are commonly used for log aggregation.

❌ Why the Other Options Are Wrong
Health checks → Monitor system availability and performance, not consolidate logs.
Webhooks → Provide event-driven notifications between systems, not log collection.
Threshold monitoring → Alerts when metrics exceed defined limits, but does not consolidate logs.

👉 So the method of consolidating system events to a single location is: Log aggregation.
Question 9 Choose 1
A Linux user runs the following command:
nohup ping comptia.com &
Which of the following commands should the user execute to attach the process to the current terminal?
Show answerHide answer

Correct answer: D fg

Explanation

Explanation:

The fg (foreground) command is used to move a background process into the current terminal's foreground.

Process Resumption: When a command is run with an ampersand (&), it executes in the background, allowing the user to continue using the shell.

Attaching to Terminal: Running fg without arguments will bring the most recently backgrounded job to the foreground.

Interaction: Once a process is in the foreground, it "attaches" to the terminal, meaning it will display its output directly to the screen and respond to keyboard interrupts like Ctrl+C.

Context: The nohup (no hangup) utility ensures the process continues running even if the user logs out, but fg is the specific mechanism used to bring that running process back to the active terminal session.

Explanation of Incorrect Answers
renice:
This command is used to alter the scheduling priority (nice value) of an already running process. It affects how much CPU time the process receives but does not change whether the process is in the background or foreground.

jobs:
The jobs command lists the active jobs and their status (Running, Stopped, etc.) for the current shell session. While it helps you identify which job number to use with fg, it does not perform the attachment itself.

exec:
The exec command is used to replace the current shell with a new process. It does not resume or attach to an existing background process; instead, it terminates the current shell and starts the specified command in its place.

Reference
CompTIA Exam Objective: Domain 1.0 (System Management) – Subsection 1.1: "Summarize and utilize Linux command line tools" (specifically Process Management and Job Control).
Reference: Linux Man Pages (man fg, man jobs); Official CompTIA Linux+ Study Guide, Chapter on Process and Job Management.
Question 10 Choose 1
A Linux systems administrator needs to extract the contents of a file named /home/dev/web.bkp to the /var /www/html/ directory. Which of the following commands should the administrator use?
Show answerHide answer

Correct answer: B pushd /var/www/html/ && cpio -idv < /home/dev/web.bkp && popd

Explanation

Explanation:

The administrator needs to extract the contents of a backup file:
/home/dev/web.bkp
into:
/var/www/html/

The correct command uses cpio, which is commonly used for backup archives (.bkp files).

pushd /var/www/html/ && cpio -idv < /home/dev/web.bkp && popd

What each part does
pushd /var/www/html/
Temporarily changes to the target directory.

cpio -idv
-i → extract files
-d → create directories as needed
-v → verbose output

< /home/dev/web.bkp
Reads archive input from the backup file.

popd
Returns to the original working directory.

✅ Result: files are extracted directly into /var/www/html/.

❌ Why the Other Options Are Incorrect
❌ cd ... && gzip -c ... | tar xf -
Assumes the backup is gzip + tar formatted.
No indication the file is compressed.
Incorrect extraction method.

❌ tar -c -f /home/dev/web.bkp /var/www/html/
-c creates an archive.
Opposite of what is required.

❌ unzip -c /home/dev/web.bkp /var/www/html/
unzip works only with .zip archives.
.bkp is not a ZIP file.

🧠 Linux+ XK0-006 Exam Tip
Common archive tools:
Tool Typical Extension
tar .tar, .tar.gz
cpio .cpio, .bkp ✅
gzip .gz
unzip .zip

💡 Exam keyword trigger:
If you see a generic backup file (.bkp) and redirection < file, think cpio -i for extraction.
Full mock exam

Sit the XK0-006 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real XK0-006 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full XK0-006 mock exam
  • 87questions per mock
  • 90 mintime limit
  • 150questions in the bank
  • Newmock on every attempt