CompTIA Linux+ Practice Test (XK0-005)
Use the form below to configure your CompTIA Linux+ Practice Test (XK0-005). The practice test can be configured to only include certain exam objectives and domains. You can choose between 5-100 questions and set a time limit.

CompTIA Linux+ XK0-005 Information
CompTIA Linux+ (XK0-005) Exam
The CompTIA Linux+ (XK0-005) certification is designed for IT professionals who work with Linux systems. It validates skills in system administration, security, scripting, and troubleshooting. This certification is vendor-neutral, covering multiple distributions such as Ubuntu, CentOS, and Red Hat.
Exam Overview
The XK0-005 exam consists of a maximum of 90 questions, including multiple-choice and performance-based questions. Candidates have 90 minutes to complete the test. The exam costs $358 USD. A passing score is 720 on a scale of 100 to 900. The certification is valid for three years and can be renewed through CompTIA’s continuing education program.
Exam Content
The XK0-005 exam focuses on five main domains: system management, security, scripting and automation, troubleshooting, and Linux fundamentals. System management includes package management, system monitoring, and user administration. Security covers permissions, authentication, and encryption. Scripting and automation focus on Bash scripting and task automation. Troubleshooting tests problem-solving skills for system failures and performance issues. Linux fundamentals include file system hierarchy, networking, and command-line operations.
Who Should Take This Exam?
The CompTIA Linux+ certification is ideal for system administrators, Linux support technicians, and DevOps professionals. It is recommended for individuals with at least one year of Linux experience. This certification is beneficial for IT professionals working with servers, cloud infrastructure, and cybersecurity.
How to Prepare
Candidates should review the official CompTIA Linux+ Exam Objectives and study materials provided by CompTIA. Hands-on experience with Linux systems is essential. Practice exams can help assess readiness and identify weak areas. Using Linux in a lab or virtual environment can provide practical experience with commands, system configuration, and troubleshooting.
Summary
The CompTIA Linux+ (XK0-005) certification is a valuable credential for IT professionals working with Linux systems. It validates essential skills in system administration, security, and automation. This certification is ideal for those managing Linux-based environments in IT infrastructure, cybersecurity, and cloud computing.
Scroll down to see your responses and detailed results
Free CompTIA Linux+ XK0-005 Practice Test
Press start when you are ready, or press Change to modify any settings for the practice test.
- Questions: 15
- Time: Unlimited
- Included Topics:System ManagementSecurityScripting, Containers, and AutomationTroubleshooting
A Linux administrator needs to ensure that a web-based application service does not start until after the graphical interface has been loaded. Which directive should the administrator use within the service's unit file to enforce this dependency?
Wants=graphical.target
Requires=graphical.target
BindsTo=graphical.target
After=graphical.target
Answer Description
The After=graphical.target
directive is used within a systemd unit file to specify that the service should start after the specified target, in this case, the graphical interface, has been reached during the boot process. The Requires=graphical.target
establishes a strong dependency, but doesn't specify order. The BindsTo=graphical.target
establishes an even stronger binding dependency, but also doesn't specify order. Wants=graphical.target
creates a weaker dependency and doesn't guarantee the service will start after the graphical interface.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a systemd unit file?
What does 'graphical.target' refer to in a Linux system?
What are the differences between After=, Requires=, and Wants= in systemd?
You have been working on a new feature in a separate branch called 'feature-xyz' of your project's repository. After completing the work on your feature, you want to integrate it into the main codebase. What is the next step to request the integration of your changes into the 'main' branch, ensuring that your peers can review it before it is merged?
Push the changes from your 'feature-xyz' branch directly to the 'main' branch without a pull request.
Commit the changes in your 'feature-xyz' branch and notify your team that the feature is complete.
Create a pull request in the repository, comparing your 'feature-xyz' branch to the 'main' branch.
Tag the latest commit in your 'feature-xyz' branch and ask your team to review the tag.
Answer Description
The correct answer is to create a pull request. A pull request is initiated by the contributor to propose the changes made in their branch to be pulled into another branch, typically the main repository branch. It provides an opportunity for peer review and discussion before the changes are merged. Pushing changes directly without a pull request bypasses the review process, while committing changes only affects the local repository and does not notify team members of the proposed changes. Tagging the latest commit creates a reference to a specific point in the repository history, but it does not facilitate the merging and review process like a pull request does.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a pull request?
Why is peer review important before merging changes?
What happens if I push changes directly to the main branch?
An administrator in your organization is concerned about performance issues and believes that Security-Enhanced Linux (SELinux) may be impacting the system's performance negatively. The admin has decided to completely disable SELinux to test this theory. After changing the SELinux mode to 'disabled' and rebooting the system, what long-term security implications should the administrator be made aware of?
The system performance will improve without any negative security implications since file permissions and ACLs continue to protect the system.
SELinux will automatically re-enable after an update, minimizing long-term security risks.
SELinux can be re-enabled without rebooting, thus no long-term security implications exist.
The system will rely solely on traditional Unix/Linux permissions, leading to potential security vulnerabilities.
Answer Description
Disabling SELinux entirely can expose the system to vulnerabilities and security threats that SELinux would ordinarily mitigate. SELinux provides a layer of security by enforcing access control policies that are not managed by traditional Unix/Linux permissions. When disabled, these policies do not apply, leaving the system susceptible to unauthorized access and potential exploits. The administrator should be aware of the increased risk and consider alternative methods for diagnosing performance issues, such as permissive mode, without compromising on security.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is SELinux and why is it important?
What does it mean for the system to rely solely on traditional Unix/Linux permissions?
What alternatives exist to diagnose performance issues without disabling SELinux?
A monitoring service unit omits a Type line. Its executable launches a secondary task and then exits, yet the task continues running. After start, systemctl status reports failure, even though the task remains active. What addition to the [Service] section allows systemd to track the actual running process?
Add PIDFile=/run/monitor.pid
Add Type=notify
Add Type=forking
Add RemainAfterExit=yes
Answer Description
Adding Type=forking signals that the service will start a background process and that the original process will terminate. Systemd then waits for the forked task rather than treating the initial exit as a failure. Type=notify demands implementation of the notification protocol, which this service does not use. A PIDFile directive alone does not change how systemd interprets process exits. RemainAfterExit applies to one-off tasks and does not cause systemd to follow a persistent background process.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does Type=forking do in a systemd service?
How does systemd identify processes for monitoring?
What are the other types of service specified in systemd?
If a system administrator wants to update the GRUB2 boot loader on a system that uses BIOS, which command should be used to ensure GRUB2 is properly installed onto the Master Boot Record (MBR)?
grub2-update
grub2-mkconfig -o /boot/grub2/grub.cfg
update-grub
grub2-install /dev/sda
Answer Description
The grub2-install
command is used to install the GRUB2 bootloader to the MBR when a system is using BIOS firmware. This command is critical when repairing or reconfiguring the GRUB2 installation. The grub2-mkconfig
command generates a new GRUB2 configuration file based on the current system settings, but does not install GRUB to the MBR. There is no such command as grub2-update
, and while update-grub
is a wrapper script commonly found in Debian-based Linux distributions that calls grub2-mkconfig
, it is not the correct command for installing GRUB2 to the MBR.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a Master Boot Record (MBR)?
How does GRUB2 differ from the original GRUB?
Why do I need to use 'grub2-mkconfig' after installing GRUB2?
Which invocation will display the free capacity of the /var filesystem strictly in gigabyte units?
-m /var
-BG /var
--si /var
-h /var
Answer Description
Using the block-size option with a gigabyte parameter forces output into gigabyte units; other options either mix units, use megabytes, or apply SI prefixes variably. Specifically, the chosen invocation prints sizes with a “G” suffix for clarity.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the '-BG' option do in the context of displaying filesystem capacity?
What are the common options for the 'df' command and how do they differ?
Why is it important to have precise unit measurements when managing filesystems?
During resource-intensive operations, a Linux system administrator needs to ensure that a new statistical analysis application doesn't consume excessive CPU resources, potentially impacting the performance of other critical services. Which of the following commands will start the new application with a reduced CPU priority?
renice -n 10 -p /path/to/stat_analysis_app
adjust -n 10 /path/to/stat_analysis_app
nice -n 10 /path/to/stat_analysis_app
priority -10 /path/to/stat_analysis_app
Answer Description
The correct command to start a new process with a reduced CPU priority is nice -n 10 /path/to/stat_analysis_app
, where -n 10
adjusts the niceness level, thereby decreasing the process's priority. The usage of priority
and adjust
commands is incorrect because they are not standard Linux commands used for managing process priorities. The renice
command, although related to priority management, is used for changing the priority of an already running process, not for starting a new one with a specific priority.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the `nice` command do in Linux?
What is meant by 'niceness' in process management?
What is the difference between `nice` and `renice` commands?
Using the groupadd
command with the -r
option creates a system group.
False
True
Answer Description
The -r
option with the groupadd
command is used for creating a system group. A system group is typically used for running system services and system users; it is not intended for login users. Therefore, it's important for administrators to understand and use this option appropriately in the context of system security and user management.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of a system group?
How does the `-r` option affect group creation?
Can you provide examples of services that might use system groups?
Which of the following commands is used to check and repair filesystem errors on a Linux system?
chown
fsck
dd
fdisk
chmod
mkfs
Answer Description
The fsck
command is used to check and repair Linux filesystem errors. This command can be applied to filesystems that are currently unmounted or in an unclean state to inspect them or rectify inconsistencies that are found during the scan. It is often used during system boot time or maintenance mode. Other tools like mkfs
are used to create filesystems, not check or repair them, and dd
is a command used for copying and converting data.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the 'fsck' command do in more detail?
When should I use 'fsck' command?
What are the differences between 'fsck' and 'mkfs'?
A system administrator has noticed SELinux is preventing a web application from functioning properly on a production server running the 'targeted' policy. The administrator wants to temporarily relax SELinux enforcement to diagnose the issue without entirely disabling SELinux or making permanent policy changes. Which command should the administrator use to fulfill this requirement?
enforce 0
setenforce Disabled
setenforce 0
setsebool -P
setenforce enforcing
Answer Description
The setenforce 0
command sets SELinux to 'Permissive' mode. In 'Permissive' mode, SELinux continues to evaluate rules and log violations but does not enforce the policy, allowing the administrator to see what would be blocked without impacting the application. Once the evaluation is complete, using setenforce 1
would return SELinux to 'Enforcing' mode. 'setsebool -P' is used to make persistent changes to SELinux booleans, enforce 0
is invalid syntax, and setenforce enforcing
uses incorrect terminology. The term 'Disabled' does not apply to runtime changes and is only set in SELinux config files which requires a reboot.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is SELinux and why is it used?
What does switching SELinux to 'Permissive' mode actually do?
How do you revert SELinux back to 'Enforcing' mode?
A Linux administrator is configuring a system to make sure that any user attempting to access a certain service should present two different forms of identification. Which of the following authentication methods should the administrator configure?
Tokens
Pluggable authentication modules (PAM)
Multifactor authentication (MFA)
System Security Services Daemon (SSSD)
Answer Description
Multifactor authentication (MFA) requires users to provide two or more verification factors to gain access to a resource such as applications, online accounts, or VPNs, making it significantly more secure than single-factor authentication methods. Tokens and Pluggable Authentication Modules (PAM) are forms of single-factor authentication methods, whereas System Security Services Daemon (SSSD) is an authentication broker but does not inherently indicate a requirement for multiple forms of identification.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are the different factors used in Multifactor Authentication (MFA)?
How does Pluggable Authentication Modules (PAM) work?
What role does the System Security Services Daemon (SSSD) play in Linux authentication?
What command would be used to perform a basic scan of a target system's open ports using Nmap?
nmap --top-ports 10
nmap -A
nmap
nmap -sV
Answer Description
The correct answer is nmap <target>
because Nmap is a network scanning tool, and the most basic usage involves executing nmap
followed by the specification of the target, which can be an IP address or hostname. This command will initiate a simple scan to find open ports on the target. Other options like -A
and -sV
add extra functionality, such as OS detection and service version detection, which is not required for a basic port scan. The --top-ports
option specifies that only a certain number of the most common ports should be scanned, not all ports, which would be the default for a basic scan without additional arguments.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does Nmap stand for and what are its primary uses?
What are open ports, and why are they important to scan?
What are the benefits of using the additional options in Nmap, like -A or -sV?
When administering a system, which command would you use to load a kernel module for immediate use without reflecting on module dependencies or its configuration?
modinfo
modprobe
lsmod
insmod
Answer Description
'insmod' is the correct command for directly inserting a module into the Linux kernel without checking module dependencies. 'modprobe', in contrast, inserts a module considering its dependencies. 'lsmod' lists the currently loaded modules, and 'modinfo' provides detailed information about a specific module. Hence, the correct choice involves using 'insmod' when you do not want to account for dependencies.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are kernel modules?
What is the difference between 'insmod' and 'modprobe'?
How can I check which kernel modules are currently loaded?
Which command should be used to verify that the rules currently loaded into the kernel's packet filter are allowing inbound SSH traffic on port 22?
iptables -L
ifconfig
netstat -tuln
nmap -p 22 localhost
Answer Description
The correct answer is iptables -L
, which lists all current firewall rules set by iptables, including those that pertain to the default port for SSH traffic (port 22). It's important to inspect these rules when SSH traffic is being blocked, as a misconfigured or overly restrictive rule might prevent inbound connections. ifconfig
is used for configuring network interfaces, not for checking firewall rules. The netstat
command is used to display network connections, listening ports, and routing tables, but it doesn’t provide information about firewall rules. nmap
is a network scanner and while it can show which ports are open, it does not display actual firewall rules.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the iptables command do specifically?
What does 'allowing inbound SSH traffic' mean?
What is the significance of port 22 for SSH?
A systems administrator notices that a user who was recently added as a member of the 'data-analysts' group cannot modify files in the 'analytics_reports' directory. The directory permissions are set to drwxrwx---
. The user and group ownerships are 'datamgr' and 'data-analysts' respectively. The administrator has verified that the user is indeed a member of the 'data-analysts' group. What should the administrator investigate as the most likely cause of this issue?
There is full disk space, preventing any changes to files
There are file-specific ACLs that override group permissions and prevent modifications
The filesystem for the 'analytics_reports' directory is mounted as read-only
The user has not logged out and back in since being added to the group
Answer Description
The correct answer is 'The user has not logged out and back in since being added to the group'. In Linux, when a user is added to a new group, the group membership is not applied to the user's current sessions. They need to log out and log back in for the system to recognize their new group memberships. 'Full disk space' is incorrect because disk space issues would not affect permissions, 'Filesystem mounted as read-only' is not the likely cause as that would affect all users and not just one, and 'File-specific ACLs' might seem plausible but the question implies group permission is the problem, not specific file permissions.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why do users need to log out and log back in to refresh group memberships in Linux?
What are group permissions in Linux, and why are they important?
What are ACLs, and how do they differ from standard permission settings in Linux?
Smashing!
Looks like that's it! You can go back and review your answers or click the button below to grade your test.