CompTIA Linux+ Certification

CompTIA XK0-005 Practice Test & Study Guide

CompTIA Linux+ Exam

Exam code
XK0-005
Questions
487
Updated
25 Nov 2026

What's in the XK0-005 study guide

  • 487practice questions with answers
  • PDFread and print on any device
  • Test enginepractice and exam modes online
  • 90 daysof free updates
  • Instant access from My Account after payment
  • 90 days of free updates
  • Money-back guarantee – see conditions
  • Help by live chat or email

Price$45

Choose a format

Prices in USD. Downloads appear in My Account once your order is complete.

  • Instant access from My Account after payment
  • 90 days of free updates
  • Money-back guarantee – see conditions
  • Help by live chat or email
Free demo

XK0-005 sample questions

Check the style and quality of the material before you buy.

Question 1

An administrator is provisioning an Apache web server. When the administrator visits the server website, the browser displays a message indicating the website cannot be reached. Which of the following commands should the administrator use to verify whether the service Is running? 

  • A. systemctl status httpd  
  • B. systemctl mask httpd  
  • C. systemctl reload httpd  
  • D. systemctl restart httpd  

Answer: A

Explanation

systemctl status httpd is the correct option to check if the Apache web server (httpd) is running. The systemctl status command provides detailed information about the service, including whether it is active and running. active and running.

Question 2

The journald entries have filled a Linux machine's /var volume. Which of the following is the best command for a systems administrator to use to free up the disk space occupied by these entries? 

  • A. journalctl ”rotate journalctl --vacuum-time=ls 
  • B. systemctl stop systemd-journald systemctl start systemd-journald
  • C. rm -rf /var/log/journal systemctl restart systemd-journald 
  • D. pkill -HUP systemd-journald systemctl restart systemd-journald 

Answer: B

Explanation

systemctl stop systemd-journald systemctl start systemd-journald is the best approach among the given options. Stopping and starting the systemd-journald service can help in managing the disk space used by journal logs without manually deleting log files or using more aggressive cleanup methods. This method ensures that log management is handled gracefully by the system's own services.

Question 3

A Linux administrator needs to determine if prerequisites are met. One of the application requirements is to install Perl on a system. Which of the following commands would accomplish this task? 

  • A. rpm -Uf perl  
  • B. rpm -iv perl  
  • C. rpm -qa perl  
  • D. rpm -eh perl  

Answer: C

Explanation

rpm -qa lists all installed packages and filtering with perl will show if Perl is installed or not. This command is useful for verifying prerequisites like the presence of certain software on the system.

Question 4

A Linux administrator is tasked with moving files in a database server. The administrator must not overwrite any existing files. Which of the following commands would indicate that the file already exists? 

  • A. mv -i filename /tmp/backup  
  • B. mv -b filename /tmp/backup  
  • C. mv -n filename /tmp/backup  
  • D. mv -f filename /tmp/backup  

Answer: A

Explanation

The -i option stands for 'interactive' and it prompts before overwriting any existing files. This ensures that no existing files are accidentally overwritten during the move operation.

Question 5

A Linux administrator is troubleshooting an SSHD issue on a server. Users are receiving error messages stating the connection is refused. Which of the following commands should be used to verify whether the service is listening?

  • A. nslookup  
  • B. route  
  • C. netstat  
  • D. ifconfig  

Answer: C

Explanation

netstat is a command-line tool that displays network connections, routing tables, and a number of network interface statistics. It can be used to check if the SSHD service is listening on its default port (usually port 22) or any other configured port.

Question 6

Due to performance issues on a server, a Linux administrator needs to terminate an unresponsive process. Which of the following commands should the administrator use to terminate the process immediately without waiting for a graceful shutdown? 

  • A. kill -SIGKILL 5545  
  • B. kill -SIGTERM 5545  
  • C. kill -SIGHUP 5545  
  • D. kill -SIGINT 5545  

Answer: A

Explanation

SIGKILL is used to immediately terminate a process without allowing it to clean up. It does not give the process a chance to gracefully shut down, which is what's needed in the case of an unresponsive process.

Question 7

A technician just fixed a few issues in some code and is ready to deploy the code into production. Which of the following steps should the technician take next?  

  • A. Create a new branch using git checkout.  
  • B. Perform a git clone to pull main down.  
  • C. Create a git pull request to merge into main.  
  • D. Perform a git pull to update the local copy of the code.  

Answer: C

Explanation

After fixing issues in the code, the next step is to merge these changes into the main branch. This is typically done by creating a pull request78.

Reference

7( https://zeet.co/blog/deploy-to-production ) 8( https://stackoverflow.com/questions33511/git-deploy-to-production )

Question 8

An administrator is running a web server in a container named web, but none of the error output is not showing. Which of the following should the administrator use to generate the errors on the container? 

  • A. docker-compose inspect WEB  
  • B. docker logs WEB  
  • C. docker run ”name WEB ”volume/dev/stdout:/var/log/nginx/error.log  
  • D. docker ps WEB -f  

Answer: B

Explanation

The docker logs command is used to fetch the logs of a container. If the error output is not showing for a running container, the docker logs command can be used to view these details56.

Reference

5( https://www.docker.com/blog/how-to-fix-and-debug-docker-containers-like-a-superhero/ ) 6( https://stackoverflow.com/questions83385/getting-console-output-from-a-docker-container )

Question 9

A network administrator issues the dig ww. compti a. org command and receives an NXDOMAIN response. Which of the following files should the administrator check first? 

  • A. /etc/resolv.conf  
  • B. /etc/hosts  
  • C. /etc/sysconfig/network-scripts  
  • D. /etc/nsswitch.conf  

Answer: A

Explanation

The dig command uses the DNS servers listed in the /etc/resolv.conf file to resolve domain names. If the dig command returns an NXDOMAIN response, it means the domain does not exist according to the DNS servers used. Therefore, the administrator should check the /etc/resolv.conf file first34.

Reference

3( https://www.linuxquestions.org/questions/linux-newbie-8/help-me-dig-status-nxdomain4175684441/ ) 4( https://serverfault.com/questions025/what-are-all-the-flags-in-a-dig-response )

Question 10

While troubleshooting server issues, a Linux systems administrator obtains the following output: [rootGhost ~]# total free -m used free shared buf f/cache available Mem: 3736 3598 88 2 48 29 Swap: 2047 1824 223 Which of the following best describes the state of the system? 

  • A. The system has consumed the system memory and swap space.  
  • B. The system has enough free memory space.  
  • C. The system has swap disabled.  
  • D. The system has allocated enough buffer space.  

Answer: B

Explanation

The output shows that the system has a total of 3736MB of memory, of which 3598MB is free. This indicates that the system has enough free memory space12.

Reference

1( https://phoenixnap.com/kb/swap-space ) 2( https://www.baeldung.com/linux/swap-space-use )

Why RealExamCollection is the best choice for CompTIA XK0-005 exam preparation

Secure your position in a competitive IT industry

The CompTIA XK0-005 certification is a strong way to demonstrate your understanding and ability. Our XK0-005 questions & answers help you prepare for it, so you can secure your current position and move your career forward.

Reviewed by IT professionals

We keep our XK0-005 practice questions up to date, with explanations. The questions and answers on RealExamCollection are reviewed by people with professional experience of CompTIA technologies.

One place to prepare

RealExamCollection brings together the material you need for the CompTIA XK0-005 exam. Explanations are added to the questions to help you understand the logic behind them and prepare for other CompTIA exams.

Updated XK0-005 questions & answers

We update the exam files regularly to add new questions. The date of the latest update is shown at the top of this page.

Free XK0-005 demo before you buy

You can view sample XK0-005 questions on this page before buying, to see the format and pattern of the material.

90 days of free updates

You are eligible for 90 days of free updates after buying the XK0-005 exam. If the file is updated in that time, you can download the latest version from your account.

Ready to prepare?

CompTIA XK0-005 · 487 questions

Choose a format