CompTIA XK0-005 Practice Exams
Last updated on Nov 16,2026- Exam Code: XK0-005
- Exam Name: CompTIA Linux+ Exam
- Certification Provider: CompTIA
- Latest update: Nov 16,2026
A systems administrator is checking the system logs. The administrator wants to look at the last 20 lines of a log.
Which of the following will execute the command?
- A . tail -v 20
- B . tail -n 20
- C . tail -c 20
- D . tail -l 20
A Linux administrator cloned an existing Linux server and built a new server from that clone.
The administrator encountered the following error after booting the cloned server:
![]()
The administrator performed the commands listed below to further troubleshoot and mount the missing filesystem:

Which of the following should administrator use to resolve the device mismatch issue and mount the disk?
- A . mount disk by device-id
- B . fsck -A
- C . mount disk by-label
- D . mount disk by-blkid
A Linux administrator is alerted to a storage capacity issue on a server without a specific mount point or directory.
Which of the following commands would be MOST helpful for troubleshooting? (Choose two.)
- A . parted
- B . df
- C . mount
- D . du
- E . fdisk
- F . dd
- G . ls
A systems administrator needs to reconfigure a Linux server to allow persistent IPv4 packet forwarding.
Which of the following commands is the correct way to accomplish this task?
- A . echo 1 > /proc/sys/net/ipv4/ipv_forward
- B . sysctl -w net.ipv4.ip_forward=1
- C . firewall-cmd –enable ipv4_forwarding
- D . systemct1 start ipv4_forwarding
A Linux administrator wants to find out whether files from the wget package have been altered since they were installed.
Which of the following commands will provide the correct information?
- A . rpm -i wget
- B . rpm -qf wget
- C . rpm -F wget
- D . rpm -V wget
A user created the following script file:
# ! /bin/bash
# FILENAME: /home/user/ script . sh echo "hello world"
exit 1
However, when the user tried to run the script file using the command "script . sh, an error returned indicating permission was denied.
Which of the follow-ing should the user execute in order for the script to run properly?
- A . chmod u+x /home/user/script . sh
- B . chmod 600 /home/user/script . sh
- C . chmod /home/user/script . sh
- D . chmod 0+r /horne/user/script. sh
Users have reported that the interactive sessions were lost on a Linux server. A Linux administrator verifies the server was switched to rescue.target mode for maintenance.
Which of the following commands will restore the server to its usual target?
- A . telinit 0
- B . systemct1 reboot
- C . systemct1 get-default
- D . systemct1 emergency
A systems administrator made some unapproved changes prior to leaving the company. The newly hired administrator has been tasked with revealing the system to a compliant state.
Which of the following commands will list and remove the correspondent packages?
- A . dnf list and dnf remove last
- B . dnf remove and dnf check
- C . dnf info and dnf upgrade
- D . dnf history and dnf history undo last
Employees in the finance department are having trouble accessing the file /opt/work/file. All IT employees can read and write the file. Systems administrator reviews the following output:

Which of the following commands would permanently fix the access issue while limiting access to IT and finance department employees?
- A . chattr +i file
- B . chown it:finance file
- C . chmod 666 file
- D . setfacl -m g:finance:rw file
As part of the requirements for installing a new application, the swappiness parameter needs to be changed to O. This change needs to persist across re-boots and be applied immediately. A Linux systems administrator is performing this change.
Which of the following steps should the administrator complete to accomplish this task?
- A . echo "vm. swappiness―()" >> /etc/sysctl . conf && sysctl ―p
- B . echo "vrn. >> / proc/meminfo && sysctl ―a
- C . sysctl ―v >> / proc/meminfo & & echo "vm. swapiness=0"
- D . sysctl ―h "vm. swapiness―O" && echo / etc/vmswapiness