Scroll down to see your responses and detailed results
Prepare for the CompTIA Linux+ XK0-005 exam with this free practice test. Randomly generated and customizable, this test allows you to choose the number of questions.
A system administrator wants to perform a directory synchronization from a local folder to a remote backup server. The requirement is to ensure that only the differences since the last sync are transferred to minimize network usage. The sync needs to be recursive to include all subdirectories and also preserve file permissions. Which command accomplishes this goal most efficiently?
rsync --update /local/directory user@remote:/backup/directory
rsync --dry-run /local/directory user@remote:/backup/directory
rsync --in-place /local/directory user@remote:/backup/directory
rsync -a /local/directory user@remote:/backup/directory
The correct answer is rsync -a /local/directory user@remote:/backup/directory
because the -a
(archive) flag is used to preserve permissions, timestamps, ownership, and to ensure recursive copying — while also optimizing by transferring only the differences from the last sync. The --dry-run
flag would only simulate the transfer without actually copying files, --update
will skip files newer on the receiver without considering other changes, and --in-place
could potentially reduce transfer efficiency as it updates destination files in place - useful for large, single files but not necessarily for directory syncs with minimal changes.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A system administrator suspects that a newly installed network card is not being recognized by the Linux kernel. Which command should be used to verify if the card is detected by the system at the hardware level?
lsusb
lsmod
dmesg | grep -i network
lspci
The 'lspci' command lists all PCI devices on the system, including network cards, regardless of whether the kernel has appropriate drivers for them. This makes it the correct tool to check if the hardware is recognized at the PCI level. 'lsusb' is incorrect because it lists USB devices, not PCI devices. 'dmesg | grep -i network' could show kernel messages about network cards, but it would not necessarily list all PCI devices. 'lsmod' is used to display the kernel modules currently loaded, which is useful for driver information but not for listing hardware.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A Linux system administrator notices that despite clearing a substantial amount of data, the 'df' and 'du' commands show significant differences in disk usage reports, and users are unable to create new files. What is the MOST likely cause of this problem?
The file system has reached its maximum number of available inodes
The '/tmp' directory is full
The file system is corrupted
Rogue processes are continuously consuming disk space
The discrepancy between 'df' and 'du' along with the inability to create new files, despite apparent available disk space, points to inode exhaustion. 'df' reports total disk space including used inodes, while 'du' reports actual file data usage. Inode exhaustion occurs when all the available inodes are in use; new files cannot be created even if physical space is available. A corrupted filesystem would also prevent new files from being created, but wouldn't normally cause the discrepancies between 'df' and 'du' focused on inodes. A full '/tmp' directory would cause issues with file creation but is more likely to be related to space, not inodes, and rogue processes consuming disk space would not directly prevent new file creation if inodes were still available.
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 System booleans in the context of Security-enhanced Linux (SELinux)?
Policy types defining the level of confinement in SELinux
Background processes ensuring SELinux states are maintained
Commands used to relabel files with new security contexts
Toggle switches that can adjust SELinux policies at runtime
SELinux System booleans are toggle switches that can enable or disable certain security features within SELinux. They are used to adjust the security policy without requiring policy recompilation or relabeling, which makes them a powerful tool for system administrators when customizing the behavior of SELinux. The correct answer explains this concept accurately, whereas the other options relate to different aspects of SELinux or Linux security and do not describe System booleans.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
The security policy of your company requires a stealthy scan to minimize the chances of detection by the target system's intrusion detection system (IDS). Which Nmap command would perform a SYN scan, while also spoofing the source port to appear as 53 (DNS) and avoiding port 22 on the target 10.0.0.12?
nmap -sS --source-port 53 --excludefile no-scan-22.txt 10.0.0.12
nmap -sS -D RND:10 -g 53 10.0.0.12
nmap -sT --spoof-port 53 -p-22 10.0.0.12
nmap -sS -Pn -g 53 --skip-port 22 10.0.0.12
nmap -sS -g 53 --exclude-ports 22 10.0.0.12
nmap -sU -g 53 -p !22 10.0.0.12
The correct answer is nmap -sS -g 53 --exclude-ports 22 10.0.0.12. The -sS flag specifies a SYN scan, which is considered stealthier than a connect scan. The -g 53 option sets the source port to 53, which may help in evading certain IDS configurations as it makes the scan look like DNS traffic. The --exclude-ports 22 option ensures that port 22 is not scanned. The other answers either do not correctly form the combination or are not the proper usage of Nmap flags, making them incorrect for the required stealthy scan excluding port 22.
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 primary function of the 'resolvectl' command in a Linux system?
Manage DNS resolution on the system
Monitor network traffic in real time
Enable or disable network interfaces
Establish a VPN connection
The 'resolvectl' command is used to query and change the system resolver settings, typically provided by the systemd-resolved
service. It effectively allows users to manage DNS settings, such as querying DNS records or changing the DNS server used by the system. Answer A is correct because it directly pertains to managing DNS resolution on the system, which is the primary role of 'resolvectl'. Answer B is incorrect because 'resolvectl' does not manage the enabling or disabling of network interfaces; 'ip' or 'ifconfig' would be used for that. Answer C is incorrect because 'resolvectl' does not provide the functionality to monitor network traffic, which would be accomplished with tools like 'tcpdump' or 'wireshark'. Answer D is incorrect as it describes a function of 'networkmanager' or 'nmcli', not 'resolvectl'.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A Linux server is having intermittent problems resolving domain names, which is affecting the ability to access external websites. None of the remote services has reported downtime, and other devices on the same network are not experiencing any issues. What is the BEST step to take to diagnose the issue on the Linux server?
Ping the domain name in question to verify if domain name resolution works intermittently.
Immediately modify the /etc/resolv.conf
file to use different nameservers without doing further investigation.
Run dig +trace example.com
or nslookup example.com
to trace the path of the query from the root name servers downward.
Check for a high number of outgoing DNS queries that might indicate a misconfigured service or DNS flood attack.
To diagnose domain name resolution issues, running dig +trace example.com
or nslookup example.com
can provide detailed information about the entire process of resolving a domain name, from the root servers down to the authoritative name servers. Comparing this output with known good output can reveal any discrepancies or failures in the resolution process. If dig +trace
or nslookup
provides the correct information, this indicates that the issue is intermittent or specific to the server's resolver configuration rather than a problem with the DNS server itself. Modifying /etc/resolv.conf
would not fully diagnose the problem, as it could be a configuration issue, and checking for a high number of outgoing DNS queries or pinging the domain would not yield detailed resolution process information. Therefore, using dig
(with the +trace
option) or nslookup
is the best initial step for diagnosis.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A system administrator is deploying a multi-container application on a single Docker host. The application includes a web server container that needs to communicate with a database container. Both containers should be isolated from other network traffic on the Docker host. Which Docker network driver should the administrator use to fulfill these requirements?
Default bridge
Host
Overlay
Bridge
The correct answer is 'Bridge' because the bridge network driver provides a private network internal to the host machine, allowing containers connected to the same bridge network to communicate with each other while isolating them from other containers not connected to the bridge. The default bridge network does not provide isolation between containers, which is why it is necessary to create a user-defined bridge network for this scenario. The 'Overlay' network driver is used for networking between multiple Docker hosts, which is not the requirement here. The 'Host' mode removes network isolation and uses the host's networking directly, which does not meet the requirement for network isolation. 'Host' mode also would not use NAT because the containers would share the network with the host. Therefore, the 'Host' network driver is not suitable for this scenario.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A systems administrator needs to verify the current rules on a Linux system's firewall, including the numeric handle and specific details such as packet counts and byte counters. Which iptables
command will provide this detailed information?
iptables -n -v -L
iptables -t nat -L
iptables -S
iptables -L -v
The command iptables -n -v -L
displays the current rule set with packet and byte counters and does not resolve names, which can slow down the output if there are lots of network traffic and active rules. This is commonly used to get a precise and quick overview of the rules that are counting traffic on a Linux server. iptables -L -v
also lists the active rules with verbose output, but without the -n
option, it may attempt to resolve names, which can be less efficient in some scenarios. iptables -S
lists the active rules in a format that can be used as input to restore the table, but it does not include packet and byte counts. The iptables -t nat -L
command specifically checks only the rules in the 'nat' table, which is not what the question asked for.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
After expanding an existing disk array on a Linux file server, a systems administrator observes reduced performance during write operations. The original configuration consisted of four disks managed by the server's hardware controller, and a fifth disk was introduced to enhance storage capacity. What is the most probable cause of the observed decrease in write operation speed following the expansion?
Suboptimal cable quality is causing a bottleneck in data transfer between the controller and the disks.
The recent disk added to the server is defective, causing a delay in the array's ability to write data effectively.
The overhead of parity calculations is higher now with the additional disk, slowing down the overall write performance.
The block size of the array is not properly configured for the number of disks, leading to inefficient write operations.
The addition of an extra disk into a RAID 5 array increases the complexity of the parity computation for every write operation. Since RAID 5 needs to update the parity information across the drives for data protection, it inherently suffers from write penalties. This can become more pronounced as the array extends, due to the added overhead of handling the parity calculations across an additional disk. The SATA protocol for connecting disks to the controller is not specified in the question, and while degraded cables or faulty hardware could cause slowdowns, they don't directly relate to the expansion of the array, thus are less likely the primary cause of the issue.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Which command will permanently mount a filesystem at boot by adding an entry to a specific configuration file?
Edit /etc/fstab
Use mount --permanent
Execute systemctl enable mount
Use fstab --add-entry
To permanently mount a filesystem at boot in Linux, an entry must be added to the /etc/fstab
file. The mount
command only mounts filesystems temporarily until the next reboot.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A system administrator notices that a Linux server is experiencing slow performance, specifically in disk operations. Upon investigating, the administrator discovered that the I/O wait time is considerably high. Which of the following actions is the BEST course of action to reduce the high latency affecting the system?
Decrease the amount of RAM in the system to reduce the memory available for disk caching.
Increase the CPU clock speed to process I/O operations faster.
Replace the current I/O scheduler with one that is better optimized for the system's workload.
Deploy additional network interfaces to balance the I/O load.
In this scenario, the best course of action is to replace the current I/O scheduler with one that is optimized for the particular workload characteristics (e.g. CFQ, Deadline, NOOP). The I/O scheduler is responsible for ordering disk access to improve performance. Some schedulers are better suited for certain workloads than others, and so choosing the correct one can potentially reduce I/O wait times and thus lower latency.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A system administrator needs to find occurrences of the word 'refused' in the 'auth.log' file, which indicates failed SSH login attempts, and then count how many times this occurs. Which command will provide the accurate count?
grep -c 'refused' /var/log/auth.log
grep -v 'refused' /var/log/auth.log | wc -l
grep 'refused' /var/log/auth.log -c
grep 'refused' /var/log/auth.log | wc -l
The correct answer is grep -c 'refused' /var/log/auth.log
because the -c
option in the grep command provides a count of matching lines that contain the pattern specified. In this scenario, it counts the number of lines that have the word 'refused', giving an indication of the number of failed SSH login attempts logged in the 'auth.log' file. The options that include piping with the wc -l
command are incorrect because when used with grep's -c
option, they are redundant and unnecessarily complicate the command. The option that includes -v
is incorrect because this inverts the match and would count all lines that do not contain the word 'refused'.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A Linux administrator is troubleshooting a file system mounted as /dev/sdb1 at /data that seems to be causing issues when users attempt to execute scripts stored there. The device is known to only store data files and should not contain any executable code. To enhance security, the administrator had previously set specific mount options for this file system. Which mount option might the administrator have set to cause this behavior, and should now be reviewed or removed to allow script execution?
defaults
sync
nodev
noexec
nosuid
The correct answer is noexec
. This mount option prevents execution of any binaries on the mounted filesystem to increase security. If scripts need to be executed from this mount point, the noexec
option should not be used. The nosuid
option prevents the setuid bit from taking effect, which is not directly related to the ability to execute scripts, but rather affects whether users can gain elevated privileges via setuid binaries. The options nodev
and sync
are related to device node handling and write synchronization respectively, and do not impact script execution. Therefore, noexec
is the specific mount option that should be reviewed to resolve the given issue.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
A system administrator needs to verify the active firewall rules on a Linux server to ensure compliance with the company's security policies. Which of the following commands provides the most comprehensive output of the currently active firewall rules?
iptables --state
iptables -L -v -n
iptables -S
iptables -L
The command iptables -L -v -n
is the correct answer as it displays all the active rules in all chains with verbose output and does not resolve hostnames (due to the -n
flag), which can be helpful in speeding up the process. It is more comprehensive compared to just listing the rules without additional verbosity, the numeric option preserves exact network addresses and port numbers, and the combination of these flags gives the admin a detailed perspective on the rules. iptables -S
simply lists the rules in a format that can be reused as input to the firewall, and the --state flag is not a valid iptables option, leading to a command error. firewall-cmd --list-all
only works with systems using firewalld and is therefore not guaranteed to work on all Linux distributions.
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Looks like that's it! You can go back and review your answers or click the button below to grade your test.
Join premium for unlimited access and more features