50 linux plus practice test Practice Questions: Question Bank 2025
Build your exam confidence with our curated bank of 50 practice questions for the CompTIA Linux+ certification. Each question includes detailed explanations to help you understand the concepts deeply.
Question Banks Available
Current Selection
Extended Practice
Extended Practice
Why Use Our 50 Question Bank?
Strategically designed questions to maximize your exam preparation
50 Questions
A comprehensive set of practice questions covering key exam topics
All Domains Covered
Questions distributed across all exam objectives and domains
Mixed Difficulty
Easy, medium, and hard questions to test all skill levels
Detailed Explanations
Learn from comprehensive explanations for each answer
Practice Questions
50 practice questions for CompTIA Linux+
A Linux administrator needs to ensure a service starts automatically at boot and can be managed consistently across distributions using systemd. Which command best enables the service to start at boot?
A user reports they cannot create files in a shared directory. The directory permissions are set to 2775 and the user is a member of the directory's group. What does the leading '2' in 2775 accomplish?
An administrator wants to quickly display only the lines that match the string "ERROR" from /var/log/app.log. Which command is the most appropriate?
A script should run every day at 02:30 as root on a single server. Which solution is the most appropriate and standard for this requirement?
A Linux server fails to boot after a configuration change. You need to boot into a mode that provides a root shell for repairs without starting most services. Which boot target is the best choice on a systemd-based system?
A security policy requires disabling password-based SSH logins while still allowing key-based access for administrators. Which sshd_config setting accomplishes this best?
A containerized web app must store uploaded files persistently so that data remains after the container is recreated. Which approach best meets this requirement?
A new filesystem must mount automatically at boot, use its UUID, and mount with the noexec option. Where is the correct place to configure this persistently?
A company wants to centrally enforce that only members of the "devops" group can run a specific administrative command using sudo, and it must be auditable and maintainable. Which approach is the best practice?
A Linux host cannot reach external IPs. `ip addr` shows the correct address and subnet, but `ip route` shows no default route. DNS configuration is known good. Which command most directly fixes the issue until the next reboot?
An administrator wants a service to start automatically at boot on a systemd-based distribution. The service unit file already exists and works when started manually. Which command should the administrator use to configure it to start at boot?
A user reports that running a script from /usr/local/bin fails with "Permission denied" even though the file exists. The administrator confirms the file has read and write permissions but not execute permission. Which command will BEST resolve the issue?
An administrator needs to verify whether a given TCP port is allowed through the local host-based firewall on a modern Linux system using firewalld. Which command is MOST appropriate to list the currently open ports in the active zone?
A system uses systemd-journald. An administrator needs to view logs only for the ssh service from the previous boot to investigate a transient authentication issue. Which command should the administrator use?
A company wants to reduce the blast radius of a compromised web service by preventing it from reading users' home directories, even if file permissions are overly permissive. Which control BEST addresses this requirement on a Linux host?
An administrator needs a reliable way to run a cleanup script every day at 02:30, even if the system was powered off at that time. Which approach is BEST?
A Linux VM intermittently runs out of disk space. Investigation shows a single log file under /var/log grows quickly. The administrator wants to limit the maximum size and keep a fixed number of rotated copies automatically. Which solution is MOST appropriate?
A developer needs to run a one-off diagnostic command inside a running container to check an environment variable without restarting the container. Which action should the developer take?
A Linux host cannot resolve external domain names, but it can successfully ping an external IP address. The administrator confirms the default route is correct. Which is the MOST likely cause?
A security engineer wants to enforce that all interactive user password authentication uses a centralized identity provider and disables direct local password logins for SSH, while still allowing key-based access for break-glass accounts. Which configuration change BEST meets this goal?
A Linux administrator wants to ensure a service starts automatically at boot and is started immediately without rebooting. Which command best accomplishes this on a systemd-based system?
A user reports that they cannot create new files in a shared directory. The directory has permissions `drwxrwxr-x` and is owned by group `projects`. The user is in the `projects` group, but new files are being created with the user's private group instead of `projects`. Which change is the BEST way to ensure new files inherit the directory's group?
A security policy requires disabling direct SSH login for the root account while still allowing administrators to gain root access after connecting. Which configuration is the BEST practice?
A system has a custom script that must run daily at 02:15 and must NOT run if the system was powered off at that time. Which is the MOST appropriate method?
A containerized application must write logs to a location that persists after the container is recreated. Which approach BEST satisfies this requirement?
After enabling a new firewall rule, a service becomes unreachable from a remote subnet. Locally on the server, `ss -lntp` shows the service listening on `0.0.0.0:443`. The firewall uses nftables. Which command would BEST help confirm whether packets to TCP/443 are being dropped by the firewall?
You are writing a Bash script that will be executed by cron. The script relies on `PATH` containing `/usr/local/bin`, but the job fails under cron with `command not found`. Which change is the BEST practice to make the script reliable?
A server has a failing disk. You must create a block-level copy of the disk to a new disk while minimizing read retries that can stall the process. Which tool is the BEST choice?
A new compliance requirement states that administrators must be able to prove which specific command was run with elevated privileges and by whom. Which approach BEST meets this requirement on Linux?
A system boots, but a critical mount in /etc/fstab fails, dropping the machine into emergency mode. You need the system to boot normally even if that mount is unavailable, while still attempting the mount when possible. Which fstab option is the BEST fit?
A Linux administrator wants a command to show which systemd unit files are enabled to start at boot. Which command should they use?
A developer needs to ensure a Bash script stops immediately if any command fails, rather than continuing and masking errors. Which addition is the BEST choice?
An administrator needs to grant a user temporary administrative privileges for a specific task while ensuring all privileged commands are auditable. Which approach is the BEST practice?
A user reports that tab completion is not working in their interactive Bash session. The administrator suspects readline is not being invoked for interactive shells. Which file is MOST likely involved in enabling standard interactive shell behavior for the user?
A server’s DNS settings should persist across reboots. The system uses systemd-resolved. Which location is the BEST place to configure persistent DNS servers for the host?
A containerized web application must be reachable on port 8080 of the host while the container listens on port 80. Which command BEST accomplishes this using a typical container runtime?
An organization requires that only key-based SSH logins are allowed, and password authentication must be disabled for compliance. Which sshd configuration change directly enforces this requirement?
A Linux host can resolve DNS names but cannot connect to remote IPs outside its subnet. The interface has a correct IP address and subnet mask. Which misconfiguration is the MOST likely cause?
A security team needs to allow a containerized process to bind to TCP port 80 without running the process as root. Which solution BEST meets this requirement on Linux?
A production server intermittently becomes unresponsive due to memory pressure. The administrator suspects the Out-Of-Memory killer is terminating processes. Which action BEST confirms which processes were killed and why during the last incident?
A Linux administrator wants to ensure a service starts automatically at boot and is started immediately. Which command best accomplishes this on a systemd-based distribution?
A user reports they can read /var/log/app.log but cannot append to it, even though they are in the "app" group. The file is owned by root:app and has permissions -rw-r----- . What is the MOST likely explanation?
An administrator needs to run a command every day at 03:30 as root and wants to use the simplest built-in scheduler. Which is the BEST solution?
A security team requires that administrative commands be traceable to individual users. Administrators currently share the root password. Which approach BEST meets the requirement?
A system uses systemd-journald. An administrator wants journal logs to persist across reboots on a server that currently loses logs after restart. What should the administrator do?
A web server was hardened and now the httpd service fails to read files from /srv/web. Standard UNIX permissions are correct. The audit log shows an SELinux denial for httpd accessing that path. What is the BEST fix?
An administrator is writing a Bash script that should stop immediately if any command fails and should treat unset variables as errors. Which is the BEST addition near the top of the script?
A containerized application needs to store database data so it is not lost when the container is recreated. Which container storage approach BEST meets this requirement?
A Linux host cannot resolve internal DNS names, but can ping IP addresses. The administrator confirms the network interface is up and routes are correct. Which command MOST directly helps identify whether DNS configuration is the problem on a modern system using systemd-resolved?
After adding a new disk, an administrator creates an LVM logical volume and formats it with ext4, but the filesystem does not mount at boot. The entry in /etc/fstab uses the device path /dev/mapper/vgdata-lvlogs. Intermittently, the boot drops to emergency mode claiming the device is missing. What is the BEST fix to make mounting reliable?
Need more practice?
Expand your preparation with our larger question banks
CompTIA Linux+ 50 Practice Questions FAQs
linux plus practice test is a professional certification from CompTIA that validates expertise in comptia linux+ technologies and concepts. The official exam code is XK0-005.
Our 50 linux plus practice test practice questions include a curated selection of exam-style questions covering key concepts from all exam domains. Each question includes detailed explanations to help you learn.
50 questions is a great starting point for linux plus practice test preparation. For comprehensive coverage, we recommend also using our 100 and 200 question banks as you progress.
The 50 linux plus practice test questions are organized by exam domain and include a mix of easy, medium, and hard questions to test your knowledge at different levels.
More Preparation Resources
Explore other ways to prepare for your certification