CompTIA Linux+ V8 Exam XK0-006 Practice Questions

Page: 1 / 14
Total 149 questions
Question 1

A systems administrator receives reports about connection issues to a secure web server. Given the following firewall and web server outputs:

Firewall output:

Status: active

To Action From

443/tcp DENY Anywhere

443/tcp (v6) DENY Anywhere (v6)

Web server output:

tcp LISTEN 0 4096 *:443 :

Which of the following commands best resolves this issue?



Answer : C

This scenario involves firewall configuration and service accessibility, which falls under the Security domain of the CompTIA Linux+ V8 objectives. The key to resolving this issue is interpreting both the firewall output and the web server status correctly.

The web server output shows that the service is actively listening on TCP port 443, which is the standard port for HTTPS (secure web traffic). The line tcp LISTEN 0 4096 *:443 *:* confirms that the web server is running properly and is ready to accept incoming connections on port 443 from any interface. This indicates that the problem is not with the web server configuration itself.

However, the firewall output clearly shows that incoming connections to port 443 are being blocked. The rules 443/tcp DENY Anywhere and 443/tcp (v6) DENY Anywhere (v6) indicate that the Uncomplicated Firewall (UFW) is explicitly denying HTTPS traffic for both IPv4 and IPv6. As a result, external clients cannot establish a secure connection to the server, even though the service is running correctly.

To resolve this issue securely and correctly, the administrator must remove the firewall rule that denies HTTPS traffic. Option C, ufw delete deny https/tcp, directly removes the blocking rule while preserving the rest of the firewall configuration. This aligns with Linux+ best practices, which emphasize making precise firewall changes rather than disabling security controls entirely.

The other options are incorrect. Option A, ufw disable, would completely turn off the firewall, creating a significant security risk. Option B, ufw allow 80/tcp, only opens HTTP traffic on port 80 and does not resolve HTTPS connectivity issues. Option D, ufw allow 4096/tcp, incorrectly attempts to open an internal socket backlog value rather than a valid service port.

Therefore, the correct and most secure solution is C.


Question 2

Which of the following commands is used to ensure a service starts automatically at boot on a system using systemd?



Answer : B

The correct answer is B. systemctl enable httpd because it configures a service to start automatically during system boot in systems that use systemd as the init system. The enable command creates the necessary symbolic links between the service unit file and the appropriate target (such as multi-user.target), ensuring the service is launched when the system starts.

In Linux systems managed by systemd, services are controlled using the systemctl command. While systemctl start httpd (Option A) will immediately start the service, it does not persist across reboots. This means that after a system restart, the service would not automatically run unless it has been explicitly enabled.

Option C (systemctl status httpd) is used to check the current status of the service, including whether it is running, stopped, or failed, along with logs and other diagnostic information. It does not modify the service behavior.

Option D (systemctl reload httpd) is used to reload the service configuration without stopping it, typically after making configuration changes. It does not affect whether the service starts at boot.

From a Linux+ Services and User Management perspective, understanding the distinction between starting and enabling services is critical. Administrators must ensure that essential services, such as web servers or databases, are configured to start automatically to maintain system availability. The systemctl enable command is the correct method for achieving persistent service startup behavior in systemd-based systems.


Question 3

A Linux systems administrator is running an important maintenance task that consumes a large amount of CPU, causing other applications to slow. Which of the following actions should the administrator take to help alleviate the issue?



Answer : B

Process scheduling and resource management are essential Linux administration skills covered in Linux+ V8. When a process consumes excessive CPU resources, it can negatively impact overall system performance.

The correct solution is to lower the priority of the CPU-intensive task using the renice command. Niceness values influence how much CPU time a process receives relative to others. Increasing the niceness value reduces the process's priority, allowing other applications to receive CPU resources more fairly.

Option B directly addresses the issue. The other options do not. pidstat monitors processes but does not modify CPU allocation. nohup allows a process to continue running after logout but does not affect scheduling priority. bg resumes a stopped job in the background but does not reduce CPU usage.

Linux+ V8 documentation explicitly references nice and renice for managing CPU contention. Therefore, the correct answer is B.


Question 4

Due to application compatibility issues, the Python 3 OpenSSL library should not be upgraded. Which of the following commands should the systems administrator use to ensure the package stays at the current version?



Answer : C

Package management is a critical system management task covered extensively in the Linux+ V8 objectives. On Debian-based systems (like Ubuntu), administrators often need to 'pin' or 'hold' a specific package version to prevent it from being automatically updated during a general system upgrade (apt upgrade). This is commonly done to avoid breaking applications that have strict version dependencies.

The modern and most direct way to accomplish this is using the apt-mark utility. The command apt-mark hold marks the package as 'on hold' in the package manager database. Once a package is on hold, apt will skip it during upgrades until an administrator explicitly runs apt-mark unhold.

While Option D (echo 'package hold' | dpkg --set-selections) is a valid legacy method, apt-mark hold (Option C) is the preferred and more user-friendly standard in contemporary Linux administration. Option A has incorrect syntax for dpkg. Option B uses a non-existent command (set-selections is a sub-module of dpkg, not apt).

Therefore, apt-mark hold is the verified correct answer for ensuring a package remains at its current version.


Question 5

A systems administrator wants to review the logs from an Apache 2 error.log file in real time and save the information to another file for later review. Which of the following commands should the administrator use?



Answer : D

Log monitoring is a common troubleshooting task in Linux system administration, and Linux+ V8 covers command-line tools for real-time log analysis. The requirement in this scenario is twofold: view log entries as they occur and simultaneously save them to another file.

The command tail -f /var/log/apache2/error.log | tee logfile.txt fulfills both requirements. The tail -f command follows the log file in real time, displaying new entries as they are written. The pipe (|) sends this output to the tee command, which writes the data to logfile.txt while also displaying it on standard output.

The other options are insufficient. Option A redirects output to a file but prevents real-time viewing. Option C appends output but still suppresses terminal display. Option B is syntactically invalid and does not use a proper command for writing output.

Linux+ V8 documentation specifically references tee as a useful utility for duplicating command output streams. This makes option D the correct and most effective solution.


Question 6

Which of the following commands can be used to display real-time running processes on a Linux system?



Answer : B

The correct answer is B. top because it provides a dynamic, real-time view of running processes and system resource usage. The top command is an essential Linux system monitoring utility that continuously updates information about CPU usage, memory consumption, running processes, load averages, and system uptime. It is widely used by system administrators for performance monitoring and troubleshooting.

When executed, top displays a full-screen interface showing active processes sorted by resource usage (typically CPU by default). It updates at regular intervals, allowing administrators to observe changes in real time. Additionally, it offers interactive features such as sorting processes, killing processes, and filtering output, which enhances system management capabilities.

Option A (ps) is incorrect because although it lists running processes, it provides only a snapshot at a specific moment in time. It does not update dynamically unless repeatedly executed or combined with other tools.

Option C (df) is incorrect because it displays disk space usage of filesystems, not running processes.

Option D (free) is incorrect because it shows memory usage statistics, including total, used, and available memory, but does not display process-level activity.

From a Linux+ perspective, understanding tools like top is crucial under System Management objectives. It enables administrators to monitor system health, identify resource-intensive processes, and take corrective actions when necessary. Real-time monitoring is particularly important in production environments where performance issues must be diagnosed and resolved quickly.


Question 7

A Linux administrator notices that an application is having trouble connecting to an external database. Which of the following commands should the administrator use to validate the connection to the remote port exposed by a database server?



Answer : B

The correct answer is B. nc -v db.comptia.org 3306 because the nc (netcat) command is commonly used to test connectivity to a specific host and port. In this scenario, the administrator needs to verify whether the database service (commonly running on port 3306 for MySQL) is reachable from the system. The -v (verbose) flag provides detailed output about the connection attempt, including whether the connection was successful or refused.

Using nc in this way allows administrators to quickly determine if the issue is related to network connectivity, firewall restrictions, or the service not listening on the expected port. If the connection succeeds, it confirms that the port is open and reachable. If it fails, further troubleshooting can focus on firewall rules, routing, or service availability.

Option A (dig MX db.comptia.org:3306) is incorrect because dig is used for DNS queries, specifically to retrieve DNS records such as MX (mail exchange) records. It does not test port connectivity.

Option C (arp -an | grep db.comptia.org | grep 3306) is incorrect because arp displays the ARP table (IP-to-MAC address mappings) and does not provide information about TCP/UDP port connectivity.

Option D (ss -plant | grep 3306) is incorrect because ss displays local socket statistics and listening ports on the current system. It does not test connectivity to a remote host.

From a Linux+ troubleshooting perspective, tools like nc, telnet, and curl are essential for validating service availability and diagnosing connectivity issues. Netcat is particularly versatile and widely used for quick port checks in network troubleshooting workflows.


Page:    1 / 14   
Total 149 questions