Troubleshooting for CompTIA Linux+ (XK0-006)
This page covers the Troubleshooting domain of the CompTIA Linux+ (XK0-006) certification. Master Cybersecurity offers 34 practice questions in this domain, drawn from the same content we use across our timed exam simulations. Below are five sample questions with full answer explanations.
Sample Practice Questions
Question 1
A systems administrator wants to review the logs from an Apache 2 error.log file in real time and save the information to another file for later review. Which of the following commands should the administrator use?- A. tail -f /var/log/apache2/error.log > logfile.txt
- B. tail -f /var/log/apache2/error.log | logfile.txt
- C. tail -f /var/log/apache2/error.log >> logfile.txt
- D. tail -f /var/log/apache2/error.log | tee logfile.txt
Explanation
The correct answer is: D. tail -f /var/log/apache2/error.log | tee logfile.txt.
tail -f reads new lines from the file as they are written and prints them to standard output. Piping that stream through tee writes each line both to the terminal (for live review) and to logfile.txt (for later analysis), satisfying the dual requirement of seeing entries in real time and saving them to a file. tail -f /var/log/apache2/error.log > logfile.txt redirects to the file but suppresses terminal output, breaking the real-time review. tail -f ... | logfile.txt is invalid because logfile.txt is not a command — pipes connect commands. tail -f ... >> logfile.txt appends to the file but, like the single-redirect case, sends nothing to the terminal. The defining property of tee is that it splits one input into two outputs, which is exactly the ask.
Question 2
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?- A. Increase the available CPU time with pidstat.
- B. Lower the priority of the maintenance task with renice.
- C. Run the maintenance task with nohup.
- D. Execute the other applications with the bg utility.
Explanation
The correct answer is: B. Lower the priority of the maintenance task with renice..
When one runaway task is starving other applications for CPU, the right tool is renice, which adjusts a process's nice value (its scheduling priority hint) up to a less-favored value so the kernel scheduler gives competing tasks more CPU time. renice +10 -p PID would mark the maintenance task as low-priority without killing it, allowing it to keep running while yielding to higher-priority work. pidstat reports per-process CPU and I/O statistics; it does not allocate or reserve CPU time, so increase the available CPU time with pidstat is a misread of what the tool does. nohup detaches a process from the controlling terminal so it survives logout; it does not change priority. The bg utility resumes a stopped job in the background but does not affect priority either, and forcing other applications to run via bg would not address the contention. Lowering the maintenance task's priority with renice is the canonical, non-destructive remediation.
Question 3
Following the completion of monthly server patching, a Linux administrator receives reports that a critical application is not functioning. Which of the following commands should help the administrator determine which packages were installed?- A. dnf history
- B. dnf list
- C. dnf info
- D. dnf search
Explanation
The correct answer is: A. dnf history.
dnf history (and equivalently yum history on older systems) records every transaction the package manager performed — install, upgrade, downgrade, remove — along with timestamps, commands, and affected packages. After post-patch breakage, dnf history shows the most recent transaction's full set of changes, and dnf history info N drills into a specific transaction; if a regression is identified, dnf history undo N rolls back that transaction. dnf list shows currently installed and available packages but not the historical sequence of changes. dnf info shows metadata for a specific package — version, summary, description — and again has no audit-trail dimension. dnf search performs a text query across package names and descriptions and is unrelated to update history. The history subcommand is the auditable record of what changed when.
Question 4
An administrator receives the following output while attempting to unmount a filesystem: umount /data1 : target is busy. Which of the following commands should the administrator run next to determine why the filesystem is busy?- A. ps -f /data1
- B. du -sh /data1
- C. top -d /data1
- D. lsof | grep /data1
Explanation
The correct answer is: D. lsof | grep /data1.
lsof lists all open files on the system, and piping through grep /data1 filters that list to entries whose path lies under the busy mount point — the result names every process and file descriptor preventing the unmount. Once the offending processes are identified, the administrator can either kill them or change their working directory before retrying the umount. ps -f /data1 is malformed because ps does not accept a directory as a filter; the filter syntax is by user, terminal, or PID. du -sh /data1 reports the disk usage of the path but says nothing about open files. top -d /data1 misuses top's -d flag, which sets the refresh interval in seconds, not a directory filter; it would also not enumerate open files. lsof piped through grep is the canonical Unix way to diagnose a busy mount.
Question 5
A systems administrator wants to review the amount of time the NetworkManager service took to start. Which of the following commands accomplishes this goal?- A. resolvectl
- B. journalctl
- C. systemctl daemon-reload
- D. systemd-analyze blame
Explanation
The correct answer is: D. systemd-analyze blame.
systemd-analyze blame prints, in descending order of duration, how long each unit took to start during the most recent boot — a useful diagnostic for identifying slow services. systemd-analyze critical-chain shows the dependency chain that gated boot completion. resolvectl displays the systemd-resolved state, listing per-link DNS configuration and statistics; it has nothing to do with service start times. journalctl reads the journal log; while one could grep for NetworkManager start messages and infer timing, systemd-analyze blame presents the data in the right form already. systemctl daemon-reload reloads the systemd manager configuration after editing unit files and again does not report timing. systemd-analyze blame is the canonical answer for slow-start analysis.
Other CompTIA Linux+ (XK0-006) domains
- Scripting, Containers, and Automation (27 questions)
- Security (30 questions)
- System Management (43 questions)