00:20:00

CompTIA Linux+ Practice Test (XK0-005)

Use the form below to configure your CompTIA Linux+ Practice Test (XK0-005). 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-005 (v7)
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-005 (v7) Information

CompTIA Linux+ (XK0-005) Exam

The CompTIA Linux+ (XK0-005) 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-005 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-005 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-005) 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-005 (v7) Logo
  • Free CompTIA Linux+ XK0-005 (v7) Practice Test

  • 20 Questions
  • Unlimited
  • System Management
    Security
    Scripting, Containers, and Automation
    Troubleshooting
Question 1 of 20

A custom service runs a preparation script in ExecStart and a cleanup script in ExecStop. The preparation script exits with status code 2, so systemd marks the service as failed and skips cleanup on stop. Which setting added to the unit file will treat exit code 2 as normal and permit the cleanup script to run?

  • Restart=on-failure

  • ValidExitCodes=*

  • Type=forking

  • SuccessExitStatus=2

Question 2 of 20

What is the state of a Linux process that has completed execution but still has an entry in the process table?

  • Sleeping

  • Stopped

  • Running

  • Zombie

Question 3 of 20

A systems administrator needs to download a critical security patch from a vendor's website. The download link is http://vendor.com/downloads/patch.cgi?id=9a4f2, which saves the file with a non-descriptive name. To maintain clarity in the local /tmp/patches directory, the administrator wants to save the file as vendor_patch_2025-10-07.tar.gz directly during the download. Which of the following commands will achieve this?

Question 4 of 20

In the process of deploying a new virtual machine that hosts an Apache web server, a Linux administrator has opened port 80 on the server's firewall and added the host record to DNS. From a workstation on a different subnet, the administrator now needs to verify two things: (1) that the web daemon is actually bound to TCP port 80 on the new server, and (2) that the port can be reached end-to-end across the network. The administrator prefers to perform both checks with a single command-line tool that requires no configuration changes on the remote host. Which command should be used?

  • netstat -tuln | grep ':80'

  • nmap -p 80 remote_server_ip

  • openssl s_client -connect remote_server_ip:80

  • dig remote_server_ip -p 80

Question 5 of 20

Which invocation will display the free capacity of the /var filesystem strictly in gigabyte units?

  • --si /var

  • -h /var

  • -m /var

  • -BG /var

Question 6 of 20

A system administrator is tasked with allowing incoming connections to a web server hosted on Linux. The server needs to accept traffic on port 443. How should the administrator configure UFW to achieve this?

  • ufw allow 443/tcp

  • ufw deny 443/tcp

  • ufw allow 80/tcp

  • ufw allow 443/udp

Question 7 of 20

During a routine security audit, Bob discovers that developers have been adding SSH keys to the running ssh-agent without specifying a lifetime, leaving the keys resident indefinitely. To reduce risk, Bob wants any key he adds to be purged from the agent automatically one hour after it is loaded. Which ssh-add option should he use to set a one-hour lifetime?

  • ssh-add -t 3600

  • ssh-add -T 3600

  • ssh-add -x 3600

  • ssh-add -X 3600

Question 8 of 20

An administrator wants to conduct an aggressive scan to retrieve version information, run default scripts, and to detect the operating system of the target device. Which Nmap command option should be used?

  • -sn

  • -o

  • -A

  • -p-

Question 9 of 20

A system administrator needs to ensure a specific service starts automatically on system boot. Which of the following systemctl subcommands would allow the administrator to achieve this?

  • start

  • reload

  • status

  • enable

Question 10 of 20

An administrator wants to prevent users from creating hard links to a certain sensitive file on a Linux system. Which command should the administrator use to achieve this security measure?

  • setfacl -m u:user:--- /path/to/file

  • chmod 700 /path/to/file

  • chattr +i /path/to/file

  • chattr +a /path/to/file

Question 11 of 20

If a system administrator wants to update the GRUB2 boot loader on a system that uses BIOS, which command should be used to ensure GRUB2 is properly installed onto the Master Boot Record (MBR)?

  • grub2-update

  • grub2-install /dev/sda

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

  • update-grub

Question 12 of 20

Which command using a stream editor edits /var/log/payments.log in place, creates a backup with a .bak extension, and replaces every uppercase alert tag with a less alarming label?

  • awk '{gsub(/ISSUE/,"NOTICE"); print}' /var/log/payments.log > /var/log/payments.log.bak

  • sed 's/ISSUE/NOTICE/g' /var/log/payments.log > /var/log/payments.log.bak

  • sed -i.bak 's/ISSUE/NOTICE/g' /var/log/payments.log

  • perl -pi -e 's/ISSUE/NOTICE/g/' /var/log/payments.log

Question 13 of 20

What command from the net-tools suite is traditionally used to configure network interfaces on Linux systems?

  • ifconfig

  • iwconfig

  • hostname

  • netstat

Question 14 of 20

An administrator is attempting to run a graphical network-configuration utility with elevated privileges on a desktop Linux system that uses PolicyKit. The administrator must ensure that PolicyKit rules are enforced and that any password prompt appears in a graphical dialog. Which command should be used to start the tool?

  • sudo network-configuration-tool

  • pexec network-configuration-tool

  • polkit network-configuration-tool

  • pkexec network-configuration-tool

Question 15 of 20

A script needs to create a temporary file in the directory from which it is executed. The script will be called by users from various locations, so hardcoding an absolute path is not feasible. To ensure the script can reliably determine its current working directory, which of the following lines would correctly assign the absolute path of the current directory to the EXEC_DIR variable?

  • EXEC_DIR=$(dirname $0)

  • EXEC_DIR=$(which $0)

  • EXEC_DIR=$(pwd)

  • EXEC_DIR=$CWD

Question 16 of 20

A system administrator is creating a systemd timer to start a backup service exactly 10 minutes after the machine has finished booting. Which line belongs in the [Timer] section of the unit file to meet this requirement?

  • OnCalendar=*:0/10

  • OnUnitActiveSec=10min

  • OnBootSec=10min

  • OnActiveSec=10min

Question 17 of 20

A Linux administrator is configuring a new web server to host a secure application. A new SSL/TLS certificate and a corresponding key pair have been generated. To secure the data in transit between clients and the server, the administrator must correctly configure the web server software. What is the fundamental role of the server's private key in establishing a TLS session?

  • It is used to decrypt data encrypted with the server's public key and to create digital signatures to prove the server's identity.

  • It is used by the web server to encrypt the server's public certificate before presenting it to connecting clients.

  • It is installed on client systems to allow them to encrypt the initial session request sent to the server.

  • It must be sent to the Certificate Authority (CA) during the TLS handshake to validate that the server's public certificate is authentic.

Question 18 of 20

A Linux administrator is writing a maintenance script that locks user accounts. The current draft is:

#!/usr/bin/env bash
echo "Enter the username of the account to disable:"
____ USERNAME
usermod -L "$USERNAME"

Which built-in command should replace the blank to capture the user's keyboard input and store it in the USERNAME variable?

  • echo

  • grep

  • read

  • source

Question 19 of 20

A systems administrator is executing a deployment script, deploy.sh, that generates output on both stdout and stderr. The administrator needs to monitor the script's progress in real-time on the terminal while simultaneously saving all output to a file named deploy.log, overwriting the file if it already exists. Which of the following commands should the administrator use?

  • ./deploy.sh | tee -a deploy.log

  • ./deploy.sh > deploy.log 2>&1

  • ./deploy.sh | tee deploy.log

  • ./deploy.sh 2>&1 | tee deploy.log

Question 20 of 20

When configuring a systemd service unit file, which Type setting will only consider the service started after the process finishes initializing and explicitly signals that it is ready to accept connections or tasks?

  • notify

  • forking

  • simple

  • dbus