Free CompTIA Linux+ Quick Practice Test — 10 Questions Across All 5 Domains
This free CompTIA Linux+ quick-start practice test includes 10 mixed-domain questions sampled from the FlashGenius XK0-005 question bank. Perfect for a fast readiness check before committing to full-length mock exams.
What's on This CompTIA Linux+ Quick Test?
10 Free CompTIA Linux+ Quick Start Practice Questions
Each question below includes 4 answer options, the correct answer, and a detailed explanation drawn directly from the FlashGenius CompTIA Linux+ question bank.
Sample Question 1 — Automation, Orchestration, and Scripting
Which command in Ansible is used to execute a playbook on a set of hosts?
- A. ansible-playbook (Correct answer)
- B. ansible-run
- C. ansible-execute
- D. ansible-deploy
Correct answer: A
Explanation: The correct command to execute a playbook in Ansible is 'ansible-playbook'. This command runs the playbook on the specified hosts. The other options are incorrect because 'ansible-run', 'ansible-execute', and 'ansible-deploy' are not valid Ansible commands.
Sample Question 2 — Automation, Orchestration, and Scripting
In a hybrid cloud infrastructure using Kubernetes, which YAML key is used to specify the number of replicas for a deployment?
- A. replicaCount
- B. instances
- C. replicas (Correct answer)
- D. count
Correct answer: C
Explanation: In Kubernetes, the 'replicas' key is used within a deployment YAML to specify the number of pod replicas that should be running. 'replicaCount', 'instances', and 'count' are not valid keys for this purpose in Kubernetes deployment configurations.
Sample Question 3 — Security
Which command is used to modify the SELinux mode to 'permissive' on a RHEL-based system?
- A. setenforce 0 (Correct answer)
- B. selinux-configure permissive
- C. selinux-mode permissive
- D. setenforce permissive
Correct answer: A
Explanation: The correct command to set SELinux to 'permissive' mode is 'setenforce 0'. This command temporarily changes the SELinux mode until the next reboot. Option B is incorrect because there is no such command as 'selinux-configure'. Option C is incorrect because 'selinux-mode' is not a valid command. Option D is incorrect because 'setenforce' requires a numeric value, not a string.
Sample Question 4 — Security
You need to configure a firewall on a CentOS server to allow incoming SSH connections. Which command should you use?
- A. firewall-cmd --add-service=ssh --permanent (Correct answer)
- B. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
- C. ufw allow ssh
- D. systemctl enable ssh
Correct answer: A
Explanation: On CentOS, 'firewall-cmd --add-service=ssh --permanent' is used to allow SSH connections through the firewall. Option B uses iptables, which is not the recommended method on CentOS systems using firewalld. Option C uses 'ufw', which is not the default firewall on CentOS. Option D enables the SSH service but does not configure the firewall.
Sample Question 5 — Services and User Management
Which command would you use to change the default runlevel on a CentOS 7 system?
- A. systemctl set-default multi-user.target (Correct answer)
- B. systemctl isolate graphical.target
- C. systemctl enable multi-user.target
- D. systemctl start multi-user.target
Correct answer: A
Explanation: The command 'systemctl set-default multi-user.target' is used to change the default runlevel on a systemd-based system like CentOS 7. 'systemctl isolate' would change the current runlevel but not set the default. 'systemctl enable' is used for enabling services, and 'systemctl start' is used to start services, not change runlevels.
Sample Question 6 — Services and User Management
On a RHEL server, you need to create a new user that should not have a home directory. Which command would achieve this?
- A. useradd -M newuser (Correct answer)
- B. useradd -m newuser
- C. useradd --home /dev/null newuser
- D. useradd -N newuser
Correct answer: A
Explanation: The 'useradd -M' command creates a new user without creating a home directory. The '-m' option creates a home directory, '--home /dev/null' would set the home directory to /dev/null, which is not a typical or recommended location, and '-N' is not a valid option for this purpose.
Sample Question 7 — System Management
Which command would you use to list all currently loaded kernel modules in a Linux system?
- A. lsmod (Correct answer)
- B. modprobe
- C. insmod
- D. rmmod
Correct answer: A
Explanation: The 'lsmod' command is used to list all currently loaded kernel modules. 'modprobe' is used to add or remove modules from the kernel, 'insmod' is used to insert a module into the Linux kernel, and 'rmmod' is used to remove a module from the Linux kernel.
Sample Question 8 — System Management
In a hybrid cloud environment, which tool would you primarily use to automate the deployment of containers?
- A. Ansible
- B. Docker
- C. Kubernetes (Correct answer)
- D. Terraform
Correct answer: C
Explanation: Kubernetes is a platform designed for automating the deployment, scaling, and operation of application containers across clusters of hosts. Ansible and Terraform are used for automation and infrastructure as code but are not specifically for container orchestration. Docker is used for building and running containers but not for orchestrating them across a cluster.
Sample Question 9 — Troubleshooting
Which command would you use to check disk space usage on a Linux system when troubleshooting a full disk issue?
- A. df -h (Correct answer)
- B. du -sh
- C. ls -l
- D. fdisk -l
Correct answer: A
Explanation: The 'df -h' command displays the amount of disk space used and available on all mounted filesystems in a human-readable format. This is useful for identifying full disks. 'du -sh' summarizes disk usage for a directory, 'ls -l' lists directory contents, and 'fdisk -l' lists disk partitions.
Sample Question 10 — Troubleshooting
A user reports that their home directory is not accessible. Upon investigation, you find a permission issue. Which command can you use to reset the home directory permissions for the user 'john'?
- A. chmod 755 /home/john
- B. chown john:john /home/john (Correct answer)
- C. chmod 700 /home/john
- D. chown root:john /home/john
Correct answer: B
Explanation: The 'chown john:john /home/john' command sets the ownership of the home directory to the user 'john' and group 'john', which is typically required for proper access. 'chmod 755' and 'chmod 700' change permissions, not ownership. 'chown root:john' changes the owner to root, which is incorrect.
How Should I Use This Linux+ Quick Test?
Use it as a fast diagnostic. If you score 80% or higher (the XK0-005 pass mark), you're close to exam-ready and should drill weak domains. If you score below 70%, build foundations with structured study (CertMaster, Sander van Vugt, Jason Dion) plus hands-on time in a Linux VM before attempting more practice tests.
Start the free CompTIA Linux+ quick practice test now | All CompTIA Linux+ domains | CompTIA Linux+ Cheat Sheet