CompTIA Linux+ MCQs with Answers 2026

CompTIA Linux+ MCQs with Answers - Feature Image - mcqstop

40+
MCQs Covered
4
Domains Covered
720
Pass Score
2026
Updated For

The CompTIA Linux+ (XK0-005) is the industry-leading vendor-neutral Linux certification that validates your ability to configure, manage, operate, and troubleshoot Linux systems. Linux powers over 90% of the world’s servers, 100% of supercomputers, and the majority of cloud infrastructure. Whether you’re a system administrator, DevOps engineer, cloud engineer, or cybersecurity professional — Linux+ proves you have the foundational Linux skills that employers demand. These fully solved MCQs cover all four exam domains to help you pass on your first attempt.

Question 01

Which command displays the contents of a file one screen at a time, allowing both forward and backward navigation?

Acat
Bmore
Cless
Dhead
💡 Explanation: The less command displays file contents one page at a time with both forward and backward scrolling using arrow keys, Page Up/Down, and search with /pattern. more only scrolls forward. cat dumps the entire file at once (no paging). head shows only the first 10 lines by default. Remember: “less is more” — less has more features than more.

Question 02

A Linux administrator needs to install a package from a .deb file on an Ubuntu system. Which command should be used?

Arpm -i package.deb
Bdpkg -i package.deb
Cyum install package.deb
Dpacman -S package.deb
💡 Explanation: dpkg -i installs .deb packages on Debian-based systems (Ubuntu, Debian). rpm is for Red Hat-based systems (.rpm files). yum and dnf are high-level package managers for RHEL/CentOS/Fedora. pacman is for Arch Linux. For the exam, know the package management hierarchy: dpkg/rpm (low-level) vs apt/yum/dnf (high-level with dependency resolution).

Question 03

Which directory contains the system service unit files used by systemd to manage services?

A/etc/init.d/
B/usr/lib/systemd/system/
C/var/log/
D/boot/grub/
💡 Explanation: Systemd unit files are stored in /usr/lib/systemd/system/ (vendor defaults) and /etc/systemd/system/ (admin overrides). Key commands: systemctl start/stop/restart/enable/disable servicename. The /etc/init.d/ directory is legacy SysVinit. /var/log/ contains log files, and /boot/grub/ stores the GRUB bootloader config. Systemd is heavily tested on Linux+.

Question 04

Which command is used to change the ownership of a file to a different user and group simultaneously?

Achmod user:group file
Bchown user:group file
Cchgrp user:group file
Dusermod user:group file
💡 Explanation: chown user:group filename changes both the owner and group of a file. Use -R for recursive changes on directories. chmod changes permissions (not ownership). chgrp changes only the group. usermod modifies user account properties. Remember: chown = change owner, chmod = change mode (permissions), chgrp = change group.



2

Security

Domain 2 — 21% of Exam

Question 05

Which Linux file contains the hashed passwords for user accounts on modern systems?

A/etc/passwd
B/etc/shadow
C/etc/group
D/etc/security
💡 Explanation: /etc/shadow stores hashed passwords and is readable only by root (permissions 640). /etc/passwd contains user account info (UID, GID, home directory, shell) but no longer stores passwords — it shows an “x” placeholder. /etc/group stores group memberships. This separation improves security by restricting access to password hashes.

Question 06

A system administrator wants to configure the firewall to allow incoming SSH (port 22) traffic on a RHEL-based system using firewalld. Which command should be used?

Aiptables -A INPUT -p tcp --dport 22 -j ACCEPT
Bfirewall-cmd --permanent --add-service=ssh
Cufw allow ssh
Dsemanage port -a -t ssh_port_t -p tcp 22
💡 Explanation: firewall-cmd is the command-line tool for firewalld, the default firewall on RHEL/CentOS/Fedora. The --permanent flag makes the rule persist across reboots (followed by --reload). iptables is the legacy firewall tool. ufw (Uncomplicated Firewall) is used on Ubuntu/Debian. semanage manages SELinux contexts. Know all three firewall tools for Linux+.

Question 07

Which Linux security framework provides mandatory access control (MAC) by labeling files, processes, and ports with security contexts?

ASELinux ✅
BAppArmor
CPAM
DTCP Wrappers
💡 Explanation: SELinux (Security-Enhanced Linux) provides Mandatory Access Control using security labels/contexts on all objects. It has three modes: Enforcing (active), Permissive (logs only), and Disabled. Check status with getenforce or sestatus. AppArmor is an alternative MAC (used by Ubuntu) that uses path-based profiles instead of labels. PAM handles authentication, and TCP Wrappers control host-based access.



3

Scripting & Automation

Domain 3 — 19% of Exam

Question 08

What is the correct first line (shebang) that should be placed at the top of a Bash shell script to ensure it runs with the Bash interpreter?

A#!/bin/bash
B#/bin/bash
C!#/bin/bash
D##/bin/bash
💡 Explanation: The shebang #!/bin/bash tells the system to use the Bash shell interpreter to execute the script. The #! must be the very first two characters of the file. Other common shebangs: #!/bin/sh (POSIX shell), #!/usr/bin/python3 (Python), #!/usr/bin/env bash (portable Bash). After adding the shebang, make the script executable with chmod +x script.sh.

Question 09

A system administrator needs to schedule a backup script to run every day at 2:30 AM. Which crontab entry is correct?

A30 2 * * * /opt/backup.sh
B2 30 * * * /opt/backup.sh
C* 2:30 * * * /opt/backup.sh
D0 2 30 * * /opt/backup.sh
💡 Explanation: Crontab format is: minute hour day-of-month month day-of-week command. So 30 2 * * * means minute 30, hour 2 (2:30 AM), every day, every month, every day of the week. Edit crontab with crontab -e, list with crontab -l. The asterisk (*) means “every.” This is one of the most tested topics on Linux+ — memorize the field order!

Question 10

Which command searches for the word “error” in all .log files within /var/log/ recursively?

Afind /var/log -name "error"
Bgrep -r "error" /var/log/*.log
Clocate error /var/log
Dsed 's/error//' /var/log/*.log
💡 Explanation: grep -r "error" searches for the pattern “error” recursively (-r) through all matching files. Common grep flags: -i (case-insensitive), -r (recursive), -n (show line numbers), -v (invert match), -c (count matches). find searches for filenames, locate uses an index database for filenames, and sed is a stream editor for text transformation.



4

Troubleshooting

Domain 4 — 28% of Exam

Question 11

A server is running out of disk space. Which command shows disk usage by filesystem, including the percentage of space used?

Adf -h
Bdu -sh /
Cfree -h
Dlsblk
💡 Explanation: df -h (disk free, human-readable) shows filesystem usage including total size, used space, available space, and percentage used for each mounted filesystem. du -sh shows disk usage for specific directories. free -h shows RAM and swap usage. lsblk lists block devices. Remember: df = filesystem overview, du = directory-level detail.

Question 12

A process is consuming 100% CPU and the system is unresponsive. Which command can be used to find the offending process and its PID?

Atop
Bifconfig
Cnetstat
Dmount
💡 Explanation: top provides a real-time, dynamic view of running processes sorted by CPU usage by default. It shows PID, user, CPU%, MEM%, and command. Press k to kill a process, M to sort by memory. htop is a more user-friendly alternative. ifconfig shows network interfaces, netstat shows network connections, and mount shows mounted filesystems. Also know ps aux for static process listing.

Question 13

After making changes to the network configuration file, a system administrator needs to restart the networking service. Which systemctl command should be used?

Asystemctl stop NetworkManager
Bsystemctl restart NetworkManager
Csystemctl enable NetworkManager
Dsystemctl reload NetworkManager
💡 Explanation: systemctl restart stops and restarts a service — applying configuration changes. Key systemctl verbs: start (start now), stop (stop now), restart (stop+start), reload (re-read config without stopping), enable (start on boot), disable (don’t start on boot), status (check state). enable doesn’t start the service immediately — it only affects boot behavior.

Question 14

Which command displays the kernel ring buffer messages, useful for troubleshooting hardware and boot issues?

Admesg
Bjournalctl
Csyslog
Duptime
💡 Explanation: dmesg displays the kernel ring buffer — messages from the kernel about hardware detection, driver loading, and boot processes. Useful for diagnosing USB, disk, and network hardware issues. Use dmesg | tail to see the latest messages. journalctl queries the systemd journal (all logs), syslog is the traditional logging daemon, and uptime shows how long the system has been running.

⌨️ Essential Linux Commands Quick Reference

ls
List directory
contents
chmod
Change file
permissions
grep
Search text
patterns
ps aux
List running
processes
kill
Terminate
a process
tar
Archive &
compress files
ssh
Secure remote
connection
ip addr
Show network
interfaces

💡 CompTIA Linux+ Exam Tips

1
Practice Commands in a Live Terminal
Linux+ is extremely hands-on. Set up a free VM using VirtualBox with Ubuntu or CentOS and practice every command. Performance-based questions (PBQs) require you to type actual commands. There’s no substitute for muscle memory on the command line.
2
Know Both Debian AND Red Hat Package Managers
Linux+ tests both families equally. Know: apt/dpkg (Debian/Ubuntu) vs yum/dnf/rpm (RHEL/CentOS/Fedora). Understand the difference between low-level tools (dpkg, rpm) and high-level tools with dependency resolution (apt, yum, dnf).
3
Master File Permissions & Ownership
Permissions appear in every domain. Know octal (755, 644) and symbolic (rwxr-xr-x) notation, chmod, chown, chgrp, SUID, SGID, sticky bit, umask, and ACLs with setfacl/getfacl. This is one of the most heavily tested areas across the entire exam.

 

🎯 Keep Practicing — More MCQs Available!

We update our question bank regularly to match the latest CompTIA exam objectives

 

CompTIA Linux+ MCQs with Answers -infographic-mcqstop

Frequently Asked Questions

How hard is the CompTIA Linux+ exam?

Linux+ (XK0-005) is considered a moderately difficult exam. It has a maximum of 90 questions (multiple-choice and performance-based) with a 90-minute time limit. The passing score is 720 out of 900. Most candidates with 6-12 months of Linux experience need 2-3 months of preparation. The PBQs require typing actual Linux commands, making hands-on practice essential.

Is Linux+ worth it in 2026?

Yes — Linux skills are in massive demand. Over 90% of public cloud workloads run on Linux, and it dominates DevOps, cybersecurity, and cloud engineering. Linux+ is vendor-neutral (covers Ubuntu, RHEL, SUSE, etc.), recognized by the US DoD under 8140, and is a stepping stone to advanced certs like RHCSA and LFCS. Average salary for Linux-certified professionals ranges from $70,000 to $100,000.

Do I need A+ or Network+ before Linux+?

No official prerequisites exist, but CompTIA recommends at least 12 months of hands-on Linux experience. Having CompTIA A+ and Network+ provides a solid foundation but is not required. If you are already comfortable navigating the Linux command line, managing files, and understanding basic networking concepts, you can attempt Linux+ directly.

Does CompTIA Linux+ expire?

Yes, CompTIA Linux+ is valid for 3 years. To renew, earn 30 Continuing Education Units (CEUs), pass a higher-level CompTIA certification, or retake the exam. CompTIA also offers CertMaster CE, an online learning program that automatically renews your certification upon completion.

About the author

MCQS TOP

Leave a Comment

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny