Skip to content

Linux+ (v7) Practice Questions

Prepare for XK0-005 with more than an answer.

279 questions in the full set20 sample questionsUpdated Jul 16, 2026

Unlock the full exam and previous versions

  • v1CompTIA Linux+ V8 161 questions Locked
  • XK0-004Legacy CompTIA Linux+ (v6) 218 questions Locked
  • XK0-005Legacy CompTIA Linux+ (v7) 279 questions Current
Exam fee
$390 USD
Level
Intermediate
Valid for
3 years
Domains covered on the exam 4
  1. System Management32%
  2. Security21%
  3. Scripting, Containers, and Automation19%
  4. Troubleshooting28%
  1. 1

    A DevOps engineer needs to write a bash script to parse an application's version from a configuration file. The version format is version: "X.Y.Z". The script must extract only the X.Y.Z part. Given the input line config_line='version: "1.2.3-beta"', which command correctly extracts the version number?

    Show answer details

    Correct answer: B

    This command is the most direct and robust solution. It uses cut to treat the double quote (") as a delimiter (-d '"'). The string is split into three fields: version: , 1.2.3-beta, and an empty field. The -f 2 option selects the second field, which is the desired version string. This method is efficient and handles variations in the version string cleanly.

  2. 2

    An administrator is hardening a new server and wants to ensure that no world-writable files exist in the /etc directory, as this poses a significant security risk. Which command should be used to find all files in /etc that have write permissions for the 'others' category?

    Show answer details

    Correct answer: A

    The find command is the correct tool for this task. find /etc starts the search in the /etc directory. -type f limits the search to regular files. The key part is -perm -o=w, which searches for files where the permission for 'others' (o) includes write (w). The hyphen (-) before the mode indicates that at least these bits must be set.

  3. 3

    A server has failed to boot, and the administrator has booted into a rescue environment. The root filesystem (/dev/mapper/vg_root-lv_root) is suspected to have errors. Before running fsck, the administrator must ensure the filesystem is unmounted. However, umount fails because the filesystem is busy. Which command can be used to identify and terminate all processes currently using the filesystem, allowing it to be unmounted?

    Show answer details

    Correct answer: D

    The fuser command is designed specifically for this purpose. The -m option indicates that the name specified is a mount point or block device, and fuser will identify all processes using any file on that filesystem. The -k option sends a SIGKILL signal to each of those processes, terminating them. This effectively frees up the filesystem so it can be safely unmounted for maintenance with fsck.

  4. 4

    A company policy requires that all cron jobs executed on production servers are logged with a high level of detail, including the username, command, and execution time. Which system facility should be configured in /etc/rsyslog.conf to ensure all cron-related activities are captured in a dedicated log file?

    Show answer details

    Correct answer: D

    The syslog protocol defines specific facilities to categorize log messages. The cron daemon is assigned its own dedicated facility, named cron. To log all messages from the cron daemon (regardless of priority), the selector cron.* should be used in the rsyslog.conf file, followed by the destination log file path (e.g., cron.* /var/log/cron.log).

  5. 5

    A web application running on a Linux server is experiencing slow response times. A system administrator uses ss -tlnp and notices an unusually high number of connections in the SYN-RECV state for the web server process. What type of issue does this symptom most likely indicate?

    sequenceDiagram participant Client participant Server Client->>+Server: SYN Server->>-Client: SYN-ACK Note over Server: State is SYN-RECV Note over Client: Client never sends final ACK

    Show answer details

    Correct answer: C

    The SYN-RECV state indicates that the server has completed the first two steps of the TCP three-way handshake (it received a SYN and sent a SYN-ACK) and is waiting for the final ACK from the client. A large number of connections stuck in this state is a classic symptom of a SYN flood, a type of Denial-of-Service (DoS) attack where attackers send many SYN requests but never complete the handshake, exhausting the server's connection table.

  6. 6

    An administrator accidentally deleted the /boot/vmlinuz file and must resolve the issue before the server is rebooted. Which of the following commands should the administrator use to identify the correct version of this file?

    Show answer details

    Correct answer: A

  7. 7

    A cloud engineer needs to change the secure remote login port from 22 to 49000. Which of the following files should the engineer modify to change the port number to the desired value?

    Show answer details

    Correct answer: D

  8. 8

    A new file was added to a main Git repository. An administrator wants to synchronize a local copy with the contents of the main repository. Which of the following commands should the administrator use for this task? A.git reflogB.git pullC.git statusD.git push

    Show answer details

    Correct answer: B

  9. 9

    A Linux administrator needs to redirect all HTTP traffic temporarily to the new proxy server 192.0.2.25 on port 3128. Which of the following commands will accomplish this task?

    Show answer details

    Correct answer: D

  10. 10

    Developers have requested implementation of a persistent, static route on the application server. Packets sent over the interface eth0 to 10.0.213.5/32 should be routed via 10.0.5.1. Which of the following commands should the administrator run to achieve this goal?

    Show answer details

    Correct answer: D

Create an account to continue.