CompTIA Linux+ Sample Questions for XK0-005 Exam Preparation
- CertiMaan
- Oct 26, 2025
- 12 min read
Updated: Dec 15, 2025
Ace the CompTIA Linux+ XK0-005 exam with these updated and expert-curated sample questions tailored to match the latest exam format. These CompTIA Linux+ practice questions cover essential domains such as system management, security, scripting, automation, and troubleshooting—helping IT professionals prepare thoroughly for real-world Linux environments. Whether you're searching for free CompTIA Linux+ practice exams, XK0-005 dumps, or simulated mock tests, these sample questions are a valuable asset for exam readiness. Designed for system administrators and Linux enthusiasts aiming for certification, this collection helps reinforce core Linux concepts and boosts exam confidence. Begin your Linux+ journey with focused resources aligned to CompTIA’s certification goals.
CompTIA Linux+ Sample Questions List :
1. A cloud engineer needs to check the link status of a network interface named eth1 in a Linux server. Which of the following commands can help to achieve the goal?
ifconfig hw eth1
ss -ti eth1
ip link show eth1
netstat -r eth1
2. A Linux administrator modified the SSH configuration file. Which of the following commands should be used to apply the configuration changes?
systemctl reload sshd
systemctl mask sshd
systemctl stop sshd
systemctl start sshd
3. A senior Linux administrator has created several scripts that will be used to install common system applications. These scripts are published to a repository to share with the systems team. A junior Linux administrator needs to retrieve the scripts and make them available on a local workstation. Which of the following Git commands should the junior Linux administrator use to accomplish this task?
fetch
checkout
clone
branch
4. 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?
rpm -F wget
rpm -V wget
rpm -qf wget
rpm -i wget
5. A Linux administrator is configuring Apache on a system and needs to allow the service to start after every startup. Which of the following commands will allow the Linux administrator to accomplish this task while starting the service at the same time?
systemctl start —-runtime boot httpd
systemctl set-property restart httpd
systemctl enable --now httpd
systemctl mask --state=active httpd
6. An administrator needs to make some changes in the IaC declaration templates. Which of the following commands would maintain version control?
git clone https://qithub.com/comptia/linux+-.git git fetch New-Branch
git clone https://github.com/comptia/linux+-.git git status
git clone https://github.com/comptia/linux+-.git git push origin
git clone https://github.com/comptia/linuxt+-.git git checkout -b <new-branch>
7. A Linux administrator needs to expose port 9000 for a container to listen during runtime. The Linux administrator creates a Dockerfile with the following entries. # Test-Container FROM node:9-alpine - WORDDIR /usr/src/app - COPY package*.json ./ RUN npm install - copy . . EXPOSE 9000 - CMD ['npm", "start"] Which of the following commands should the administrator use to accomplish this task? (Choose two).
docker push Test-Container
docker tag Test-Container
docker build -t Test-Container
docker inspect Test-Container
docker run -p 9000:80 Test-Container
docker run -p 80:9000 Test-Container
8. A systems administrator is customizing a new Linux server. Which of the following settings for umask would ensure that new files have the default permissions: -rw-r-----?
0038
0027
0640
0017
9. Which of the following concepts describes the approach of keeping all configurations in a repository?
Agentless deployment
Infrastructure as code
Orchestration
Inventory
10. Which of the following best describes YAML?
An open-source container orchestration engine
A package used to start a cloud instance
An open-source configuration management tool
A data serialization language that is widely used in writing configuration files
11. A Linux administrator is removing non-permanent rules from the system firewall. Which of the following commands will allow the administrator to achieve this goal in the safest way possible?
firewall-cmd –-runtime-to-permanent
firewall-cmd –-complete-reload
firewall-cmd –-set-default-zone
firewall-cmd –-reload
12. A systems administrator needs to determine the largest file in a given directory. Which of the following commands should the administrator use?
df /home/CFO
ls /home/CFO
du /home/CFO
stat /home/CFO
13. A systems administrator checked out the code from the repository, created a new branch, made changes to the code, and then updated the main branch. The systems administrator wants to ensure that the Terraform state files do not appear in the main branch. Which of following should the administrator use to meet this requirement?
.ssh
.gitignore
get
Clone
14. A Linux administrator needs to schedule a system backup script /usr/local/bin/backup.sh to run every night at 1:30 a.m. Which of the following entries should the administrator add to system crontab to achieve the goal?
30 1 * /usr/local/bin/backup.sh
* 1 30 /usr/local/bin/backup.sh
1:30 * /usr/local/bin/backup.sh
1 30 * /usr/local/bin/backup.sh
15. A systems administrator wants to test the route between IP address 10.0.2.15 and IP address 192.168.1.40. Which of the following commands will accomplish this task?
ip route get 192.163.1.40 from 10.0.2.15
route -n 192.168.1.40 from 10.0.2.15
route -e get to 192.168.1.40 from 10.0.2.15
ip route 192.169.1.40 to 10.0.2.15
16. A Linux system is failing to start due to issues with several critical system processes. Which of the following options can be used to boot the system into the single user mode? (Choose two.)
Interrupt the boot process in the GRUB menu and add systemd.unit=single in the kernel line
Execute the following command from the GRUB rescue shell: mount -o remount, ro/sysroot
Interrupt the boot process in the GRUB menu and add systemd.unit=rescue.target in the kernel line
Interrupt the boot process in the GRUB menu and add systemd.unit=single.target in the kernel line
Interrupt the boot process in the GRUB menu and add init=/bin/bash in the kernel line
Interrupt the boot process in the GRUB menu and add single=user in the kernel line
17. In order to copy data from another VLAN, a systems administrator wants to temporarily assign IP address 10.0.6.5/24 to the newly added network interface enpls0f1. Which of the following commands should the administrator run to achieve the goal?
ifconfig 10.0.6.5/24 enpsls0f1
echo "IPV4_ADDRESS=10.0.6.5/24" > /etc/sysconfig/network-scripts/ifcfg-enpls0f1
ip addr add 10.0.6.5/24 dev enpls0f1
nmcli conn add ipv4.address=10.0.6.5/24 if name snpls0f1
18. A cloud engineer needs to block the IP address 192.168.10.50 from accessing a Linux server. Which of the following commands will achieve this goal?
iptables -A INPUT -s 192.168.10.30 -j DROP
iptables -F INPUT -j 192.168.10.50 -m DROP
iptables -j INPUT 192.168.10.50 -p DROP
iptables -i INPUT --ipv4 192.168.10.50 -z DROP
19. Using AD Query, the security gateway connections to the Active Directory Domain Controllers using what protocol?
Hypertext Transfer Protocol Secure (HTTPS)
Windows Management Instrumentation (WMI)
Remote Desktop Protocol (RDP)
Lightweight Directory Access Protocol (LDAP)
20. 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?
echo "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
route modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
route -i etho -p add 10.0.213.5 10.0.5.1
21. A systems administrator is building a database container. The container should perform different tasks based on the parameters that are provided during startup (for example, init, start, recover). The administrator wrote a startScript.sh script to achieve this objective. Which of the following Dockerfile statements would run the startScript.sh using the provided parameters?
ENTRYPOINT /startScript.sh
RUN /startScript.sh
EXPOSE /startScript.sh
CMD /startScript.sh
22. A Linux administrator is troubleshooting an issue in which users are not able to access https://portal.comptia.org from a specific workstation. The administrator runs a few commands and receives the following output: # cat /etc/hosts 10.10.10.55 portal.comptia.org # host portal.comptia.org portal.comptia.org has address 192.168.1.55 #cat /etc/resolv.conf nameserver 10.10.10.5 Which of the following tasks should the administrator perform to resolve this issue?
Add a network route from the 10.10.10.0/24 to the 192.168.0.0/16.
Remove the entry for portal.comptia.org from the local hosts file
Clear the local DNS cache on the workstation and rerun the host command
Update the name server in resolv.conf to use an external DNS server
23. A Linux administrator is configuring network traffic forwarding. Despite having proper iptables rules, the traffic forwarding is not working. Which of the following commands will allow Linux to pass network traffic between different interfaces?
ip route forward allow --all-interfaces ; systemctl restart network
modprobe ip_forward
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf ; sysctl -p
nmcli allow-forwarding eth0
24. An administrator started a long-running process in the foreground that needs to continue without interruption. Which of the following keystrokes should the administrator use to continue running the process in the background?
bg
jobs -1
bg
bg &
25. A systems administrator is analyzing the data usage on a Linux system. Which of the following commands will display a list of the entire /var contents along with sizes?
lsblk /var
du –ah /var/
ls –ltr /var | sort –n
df –h /var
26. A systems administrator needs to integrate a new storage array into the company's existing storage pool. The administrator wants to ensure that the server is able to detect the new storage array. Which of the following commands should the administrator use to ensure that the new storage array is presented to the systems?
lshw
lsscsi
lsusb
lsipc
27. Which of the following tools is commonly used for creating CI/CD pipelines?
Jenkins
Puppet
Chef
Ansible
28. A Linux administrator is configuring crontab and needs to schedule a task to run only on Saturday and Sunday of every week of the year at 9:00 a.m. Which of the following should the administrator use to accomplish this task?
0 9 1-5 root /root/script.sh
0 9 6,0 root /root/script.sh
0 9 1 root /root/script.sh
0 9 1 /3 root /root/script.sh
29. A new application container was built with an incorrect version number. Which of the following commands should be used to rename the image to match the correct version 2.1.2?
docker push comptia/app:2.1.1 comptia/app:2.1.2
docker rmi comptia/app:2.1.1 comptia/app:2.1.2
docker update comptia/app:2.1.1 comptia/app:2.1.2
docker tag comptia/app:2.1.1 comptia/app:2.1.2
30. A systems administrator wants to ensure all the latest patches and updates are automatically synced to the local repository every two hours on Sundays through Tuesdays in the month of May. Which of the following cron entries can the administrator use to achieve this goal? (Choose two.)
0 /2 5 0-2 /root/update-from-remote-to-local.sh
0 /2 5 0-3 /root/update-from-remote-to-local.sh
0 0,2,4,6,8,10,12,14 * 5 0-3 /root/update-from-remote-to-local.sh
0 0-23/2 * 5 0-3 /root/update-from-remote-to-local.sh
0 0-23/2 * 5 0-2 /root/update-from-remote-to-local.sh
0 0,2,4,6,8,10,12,14 * 5 0-2 /root/update-from-remote-to-local.sh
31. A Linux administrator edits a file that a system uses during the startup process to mount all the required partitions and volumes. The administrator wants to ensure no errors are in the file and the system will restart properly. Which of the following commands should the administrator use?
fsck –N
fsadm –v
mountpoint –d
mount –a
32. A newly created container has been unable to start properly, and a Linux administrator is analyzing the cause of the failure. Which of the following will allow the administrator to determine the FIRST command that is executed inside the container right after it starts?
docker info <container_id>
docker inspect <container_id>
docker export <container_id>
docker start <container_id>
33. A Linux administrator is configuring a new internal web server fleet. The web servers are up and running but can only be reached by users directly via IP address. The administrator is attempting to fix this inconvenience by requesting appropriate records from the DNS team. The details are: Hostname: devel.comptia.org - IP address: 5.5.5.1, 5.5.5.2, 5.5.5.3, 5.5.5.4 Name server: 5.5.5.254 - Additional names: dev.comptia.org, development.comptia.org Which of the following types of DNS records should the Linux administrator request from the DNS team? (Choose three).
CNAME
PTR
NS
MX
A
34. A systems administrator wants to upgrade /bin/someapp to a new version, but the administrator does not know the package name. Which of the following will show the RPM package name that provides that binary file?
rpm -i /bin/someapp
rpm -p /bin/someapp
rpm -Vv /bin/someapp
rpm -qf /bin/someapp
35. A Linux administrator is adding a new configuration file to a Git repository. Which of the following describes the correct order of Git commands to accomplish the task successfully?
pull -> push -> add -> checkout
pull -> add -> commit -> push
checkout -> push -> add -> pull
pull -> add -> push -> commit
36. A systems administrator is compiling a report containing information about processes that are listening on the network ports of a Linux server. Which of the following commands will allow the administrator to obtain the needed information?
lsof -lt
netstat -pn
tcpdump -nL
ss -plnt
37. A developer needs to launch an Nginx image container, name it Web00l, and expose port 8080 externally while mapping to port 80 inside the container. Which of the following commands will accomplish this task?
docker pull -it -p 8080:80 --name Web001 nginx
docker run -it -p 8080:80 --name Web001 nginx
docker load -it -p 8080:80 --name Web001 nginx
docker exec -it -p 8080:80 --name Web001 nginx
38. A systems administrator is notified that the mysqld process stopped unexpectedly. The systems administrator issues the following command: sudo grep –i -r ‘out of memory’ /var/log The output of the command shows the following: kernel: Out of memory: Kill process 9112 (mysqld) score 511 or sacrifice child. Which of the following commands should the systems administrator execute NEXT to troubleshoot this issue? (Select two).
killall -15
free -h
nc -v 127.0.0.1 3306
lsblk
vmstat -a 1 4
renice -15 $( pidof mysql )
39. An administrator runs ping comptia. org. The result of the command is: ping: comptia.org: Name or service not known Which of the following files should the administrator verify?
/etc/services
/etc/resolv.conf
/etc/ethers
/etc/sysctl.conf
40. After connecting to a remote host via SSH, an administrator attempts to run an application but receives the following error: [user@worksration ~]$ ssh admin@srv1 Last login: Tue Mar 29 18:03:34 2022 [admin@srv1 ~] $ /usr/local/bin/config_manager Error: cannot open display: [admin@srv1 ~] $ Which of the following should the administrator do to resolve this error?
Enable X11 forwarding in /etc/ssh/ssh_config and restart the server
Add Options X11 to the /home/admin/ .ssh/authorized_keys file
Disconnect from the SSH session and reconnect using the ssh -x command
Open port 6000 on the workstation and restart the firewalld service
41. What is the main objective when using Application Control?
To assist the firewall blade with handling traffic
To filter out specific content
To see what users are doing
Ensure security and privacy of information
42. An administrator has source code and needs to rebuild a kernel module. Which of the following command sequences is most commonly used to rebuild this type of module?
./configure make make install
build install configure
wget gcc cp
tar xvzf build cp
43. Joe, a user, is unable to log in to the system. The Linux administrator checks the /etc/passwd file and reviews the following output: Joe:x:1002:1002::/home/Joe:/sbin/nologin Which of the following should the administrator do to fix this issue?
Ensure that a corresponding entry is in the /etc/shadow file for Joe
Issue the usermod -L Joe command
Remove the x entry in the /etc/passwd file for Joe
Change the /sbin/nologin entry to /bin/sh for Joe
44. A systems administrator creates a public key for authentication. Which of the following tools is MOST suitable to use when uploading the key to the remote servers?
ssh-copy-id
ssh-keyscan
scp
ssh-agent
45. The systemd logs are disappearing after a restart, even though the free disk space is adequate. Which of the following is the cause of this behavior?
The directory /tmp does not have enough free space
The journald size limit has been exceeded
The option Storage=volatile is set in the journald configuration
The service systemd-journald is disabled and masked
46. A security technician receives a report of a suspected phishing email with an attachment named payroll.csv. The technician downloads and saves the attachment but wants to verify the attachment type before opening it. Which of the following commands should the technician use to verify the attachment type?
tree payroll.csv
file payroll.csv
df payroll.csv
cat payroll.csv
47. A Linux systems administrator wants to validate the network interfaces configuration and status on a Linux server. Which of the following commands should the administrator use to display the information for interface eth3 including status, IP address, subnet mask, and configuration?
ip list interface eth3
ip show eth3
ip addr show dev eth3
ip config eth3
48. A Linux systems administrator needs to persistently enable IPv4 forwarding in one of the Linux systems. Which of the following commands can be used together to accomplish this task? (Choose two.)
sysctl net.ipv4.ip_forward
sysctl -w net.ipv4.ip_forward=1
sysctl –p
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
49. A Linux system is failing to boot. The following error is displayed in the serial console: [[1;33mDEPEND[Om] Dependency failed for /data. [[1;33mDEPEND[Om] Dependency failed for Local File Systems ... Welcome to emergency mode! After logging in, type "journalctl -xb" to viewsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot into default mode. Give root password for maintenance (or type Control-D to continue} Which of the following files will need to be modified for this server to be able to boot again?
/ete/grub.conf
/dev/sda
/etc/mtab
/etc/fstab
50. An administrator wants to reorganize the /etc/sudoers configuration file by department groups. Which of the following actions should the administrator take?
Execute setfacl commands on /etc/sudoers and add rw permissions for each group
Create a symlink in each user's home directory to /etc/sudoers
Configure includedir /etc/sudoers.d directive inside /etc/sudoers file
Copy /etc/sudoers and name each group with incremental numbers (/etc/sudoersl, /etc/sudoers2)
FAQs
1. What is the CompTIA Linux+ XK0-005 certification exam?
It is a globally recognized certification that validates the skills needed to administer, configure, and troubleshoot Linux systems across various environments.
2. How do I become CompTIA Linux+ XK0-005 certified?
You must register for and pass the XK0-005 exam, which tests your practical and technical Linux knowledge.
3. What are the prerequisites for the CompTIA Linux+ XK0-005 exam?
There are no official prerequisites, but CompTIA recommends CompTIA A+ and Network+ certifications or equivalent Linux experience.
4. How much does the CompTIA Linux+ XK0-005 certification cost?
The exam costs $358 USD, though prices may vary by location.
5. How many questions are in the CompTIA Linux+ XK0-005 exam?
The exam includes 90 questions, a mix of multiple-choice and performance-based tasks.
6. What topics are covered in the CompTIA Linux+ XK0-005 exam?
It covers system management, security, scripting, automation, networking, and troubleshooting.
7. How difficult is the CompTIA Linux+ XK0-005 certification exam?
It’s considered moderately challenging and requires hands-on Linux experience and command-line proficiency.
8. How long does it take to prepare for the CompTIA Linux+ XK0-005 exam?
Most candidates prepare for 8–12 weeks, depending on experience and study schedule.
9. What jobs can I get after earning the CompTIA Linux+ XK0-005 certification?
You can work as a Linux Administrator, Systems Engineer, IT Support Specialist, or Network Administrator.
10. How much salary can I earn with a CompTIA Linux+ XK0-005 certification?
Professionals with this certification typically earn between $75,000–$100,000 annually, depending on experience and role.

Comments