Which of the following commands should an administrator run to check for errors during startup?
Answer : B
The correct answer is B. dmesg because it displays the kernel ring buffer, which contains messages generated during system boot and runtime. These messages include hardware initialization details, driver loading status, and error or warning messages that occur during startup. This makes dmesg one of the most important tools for troubleshooting boot-related issues in Linux.
When a Linux system boots, the kernel initializes hardware components and loads drivers. Any issues encountered during this process---such as missing drivers, hardware failures, or misconfigurations---are logged in the kernel ring buffer. By running dmesg, administrators can review these messages and identify the root cause of startup problems. It is common to combine dmesg with tools like grep (e.g., dmesg | grep -i error) to filter relevant error messages.
Option A (modinfo) is incorrect because it provides information about kernel modules, such as version and dependencies, but does not display boot errors.
Option C (dracut) is incorrect because it is used to create or regenerate initramfs images, not to check system logs or startup errors.
Option D (lshw) is incorrect because it lists detailed hardware information but does not show boot-time errors or logs.
From a Linux+ troubleshooting perspective, analyzing boot logs is critical for diagnosing system issues. The dmesg command provides immediate access to kernel-level messages, making it an essential tool for identifying hardware and driver-related problems that occur during system startup.
A Linux administrator installed a new program inside $HOME/.local/bin and is trying to execute it without using an absolute path. Which of the following should the administrator use for this task?
Answer : C
The correct answer is C. export PATH=$PATH:$HOME/.local/bin because it correctly appends the directory $HOME/.local/bin to the existing PATH environment variable. The PATH variable defines a list of directories that the shell searches when a user enters a command without specifying its full path. By adding a directory to PATH, executables within that directory can be run directly from the command line.
In this case, the administrator installed a program in $HOME/.local/bin, which is not always included in the default PATH for all systems or users. By using export PATH=$PATH:$HOME/.local/bin, the existing PATH is preserved and extended to include the new directory. The use of $PATH ensures that previously defined directories remain accessible, while the colon (:) separates multiple directory entries.
Option A is incorrect because it literally assigns the string ''PATH'' instead of referencing the current PATH variable, effectively breaking command lookup.
Option B and D are incorrect because they attempt to assign a value to $PATH, which is invalid syntax. Environment variables should be assigned using their name (PATH), not with a dollar sign.
From a Linux+ perspective, managing environment variables is a fundamental skill in user and system configuration. Properly configuring the PATH variable ensures efficient command execution and usability, especially when installing custom or user-specific applications. For persistence, this change is typically added to shell configuration files like ~/.bashrc or ~/.profile.
A DevOps engineer made some changes to files in a local repository. The engineer realizes that the changes broke the application and the changes need to be reverted back. Which of the following commands is the best way to accomplish this task?
Answer : B
The command git reset is the most appropriate option in this scenario. It allows the engineer to move the current branch pointer (HEAD) to a previous commit, effectively discarding or undoing local changes. Depending on the reset mode (--soft, --mixed, or --hard), the engineer can control whether changes are preserved in the staging area or working directory. This flexibility makes git reset the primary tool for reverting problematic local changes.
The other options are not suitable. git pull fetches and merges changes from a remote repository and does not revert local modifications. git rebase rewrites commit history and is used to reapply commits on top of another base, not to undo broken changes. git stash temporarily saves uncommitted changes for later use but does not revert the repository to a stable state.
Linux+ V8 documentation emphasizes that git reset is commonly used during local development when changes need to be undone quickly before being shared with others. Therefore, the correct answer is B.
Which of the following can be implemented with PAM to detect and block dictionary attacks?
Answer : A
Pluggable Authentication Modules (PAM) provide a flexible, centralized mechanism for managing authentication across various services in a Linux system. According to the CompTIA Linux+ V8 security domain, protecting against 'dictionary attacks' and 'brute-force' attempts is a critical hardening step. A dictionary attack involves an automated script attempting thousands of common passwords against a user account.
To mitigate this, administrators use pam_tally2 (or the newer pam_faillock on some systems). The pam_tally2 module is specifically designed to keep track of failed login attempts for each user. It can be configured in the PAM stack (such as /etc/pam.d/common-auth or /etc/pam.d/password-auth) to lock an account after a specified number of consecutive failed attempts (e.g., deny=5). Once the threshold is reached, the user is blocked from further attempts for a set period or until an administrator manually resets the counter. This effectively stops automated dictionary attacks from continuing indefinitely.
The other options serve different purposes. pam_limits (Option B) is used to set resource limits (like CPU time or number of open files) for users once they are already logged in. pam_unix (Option C) is the standard module for traditional /etc/passwd and /etc/shadow authentication. pam_ldap (Option D) allows the system to authenticate against a remote LDAP directory.
While these modules are part of the PAM ecosystem, only pam_tally2 is designed for tracking and acting upon failed login counts to block attacks.
A systems administrator needs to set the IP address of a new DNS server. Which of the following files should the administrator modify to complete this task?
Answer : B
DNS client configuration is a foundational Linux networking task covered in Linux+ V8 system management objectives. When an administrator needs to specify the IP address of a DNS server that the system should use for name resolution, the correct file to modify is /etc/resolv.conf.
The /etc/resolv.conf file defines DNS resolver settings, including one or more nameserver entries that specify the IP addresses of DNS servers. Applications and system services rely on this file to resolve hostnames to IP addresses.
The other options are incorrect. /etc/whois.conf configures WHOIS queries. /etc/nsswitch.conf controls the order of name resolution sources but does not define DNS server IP addresses. /etc/dnsmasq.conf configures a local DNS caching service, not the system-wide resolver directly.
Linux+ V8 documentation highlights /etc/resolv.conf as the authoritative DNS client configuration file, though it may be dynamically managed by tools such as NetworkManager or systemd-resolved.
Therefore, the correct answer is B. /etc/resolv.conf.
A Linux administrator needs to add a new HTTP service on the server. Which of the following commands allows other systems to communicate with the service after the system is restarted?
Answer : C
The correct answer is C. firewall-cmd --add-service=http --permanent because it ensures that the firewall rule allowing HTTP traffic remains in effect even after a system reboot. In Linux systems using firewalld, rules can be applied in two modes: runtime and permanent.
By default, when a rule is added using firewall-cmd --add-service=http (Option D), it is applied only to the runtime configuration. This means the rule will allow HTTP traffic immediately, but it will be lost once the system is restarted or the firewall service is reloaded.
The --permanent flag ensures that the rule is written to the persistent configuration files, so it survives reboots. After adding a permanent rule, administrators typically run firewall-cmd --reload to apply the changes to the runtime environment as well.
Option A is incorrect because while it reloads the firewall, it does not specify the rule as permanent, so the configuration will not persist after reboot.
Option B is incorrect because --add-port=http is not valid syntax (ports must be specified numerically, e.g., 80/tcp), and --complete-reload is not appropriate here.
Option D is incorrect because it only applies the rule temporarily (runtime only).
From a Linux+ security perspective, managing firewall rules persistently is essential for maintaining secure and consistent network access. Using the --permanent option ensures services like HTTP remain accessible across system restarts while still being controlled by firewall policies.
Which of the following commands can be used to display current CPU utilization in real time on a Linux system?
Answer : B
The correct answer is B. top because it provides a real-time, continuously updating view of system performance, including CPU utilization. The top command is one of the most widely used monitoring tools in Linux and is essential for system administrators when analyzing performance issues.
When executed, top displays a dynamic interface showing CPU usage percentages, memory consumption, load averages, running processes, and other critical system metrics. The CPU usage section is particularly useful because it breaks down usage into categories such as user space, system (kernel), idle time, and I/O wait. This allows administrators to quickly identify whether the CPU is under heavy load and which processes are consuming the most resources.
Option A (uptime) is incorrect because it provides load averages but does not give detailed or real-time CPU utilization percentages.
Option C (df) is incorrect because it reports disk space usage, not CPU activity.
Option D (lsblk) is incorrect because it lists block devices and storage structure, not CPU performance.
From a Linux+ system management perspective, tools like top, htop, and vmstat are critical for monitoring system health. Among these, top is the most fundamental and widely available tool for real-time CPU analysis. It enables administrators to detect performance bottlenecks, identify runaway processes, and take corrective action such as terminating processes or reallocating resources.