Docsity

CompTIA Linux+ Exam Prep 2026 Comprehensive Linux Certification Review Practice Questions, Exams of Cybercrime, Cybersecurity and Data Privacy

Toggle sidebar
bg1
CompTIA Linux+ Exam Prep 2026 Comprehensive
Linux Certification Review Practice Questions with
Detailed Explanations
DOMAIN 1: SYSTEM MANAGEMENT (32%) — Questions 1-32
Question 1
Which command displays the current runlevel and the previous runlevel of a Linux
system?
A) systemctl get-default
B) runlevel
C) who -r
D) init --list
Answer: B
Rationale: The runlevel command displays the current and previous runlevels of
the system. It shows two characters: the previous runlevel (or N if none) and the
current runlevel. systemctl get-default displays the default target in systemd
systems. who -r also shows the current runlevel, but runlevel is the more direct
command for this specific purpose.
Question 2
A Linux administrator needs to view all block devices currently attached to the
system, including their partition tables and sizes. Which command should be used?
A) lsblk
B) fdisk -l
C) df -h
D) parted -l
Answer: A
Rationale: lsblk displays all block devices in a tree-like format, showing names,
sizes, types, and mount points. It provides a clean, readable overview of all storage
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a

Partial preview of the text

Download CompTIA Linux+ Exam Prep 2026 Comprehensive Linux Certification Review Practice Questions and more Exams Cybercrime, Cybersecurity and Data Privacy in PDF only on Docsity!

CompTIA Linux+ Exam Prep 2026 Comprehensive

Linux Certification Review Practice Questions with

Detailed Explanations

DOMAIN 1: SYSTEM MANAGEMENT (32%) — Questions 1- 32 Question 1 Which command displays the current runlevel and the previous runlevel of a Linux system? A) systemctl get-default B) runlevel C) who - r D) init --list Answer: B Rationale: The runlevel command displays the current and previous runlevels of the system. It shows two characters: the previous runlevel (or N if none) and the current runlevel. systemctl get-default displays the default target in systemd systems. who - r also shows the current runlevel, but runlevel is the more direct command for this specific purpose. Question 2 A Linux administrator needs to view all block devices currently attached to the system, including their partition tables and sizes. Which command should be used? A) lsblk B) fdisk - l C) df - h D) parted - l Answer: A Rationale: lsblk displays all block devices in a tree-like format, showing names, sizes, types, and mount points. It provides a clean, readable overview of all storage

devices. fdisk - l also shows partition tables but is more verbose and requires root privileges. df - h shows mounted filesystem usage, not all block devices. parted - l displays partition information but is more specialized. Question 3 Which file in the /proc filesystem contains information about the system's CPU architecture and capabilities? A) /proc/meminfo B) /proc/cpuinfo C) /proc/version D) /proc/uptime Answer: B Rationale: /proc/cpuinfo contains detailed information about the system's CPU(s), including architecture, model, speed, and capabilities (flags). /proc/meminfo contains memory information, /proc/version contains kernel version information, and /proc/uptime shows system uptime. Question 4 A system administrator needs to configure a static IP address on a system using nmcli. Which command correctly sets the IPv4 address? A) nmcli con mod eth0 ipv4.addresses 192.168.1.100/ B) nmcli con mod eth0 ipv4.address 192.168.1.100/ C) nmcli con set eth0 ipv4.addr 192.168.1.100/ D) nmcli con change eth0 ipv4 192.168.1.100/ Answer: A Rationale: nmcli con mod (modify) with ipv4.addresses is the correct syntax to set a static IP address on a connection. The address must include the subnet mask in CIDR notation (e.g., /24). Option B uses incorrect syntax (ipv4.address), and options C and D use invalid commands.

C) chgrp D) usermod Answer: B Rationale: chown (change owner) is used to change the ownership of a file or directory to a specific user and optionally group. The syntax is chown user:group filename. chmod changes permissions, chgrp changes group ownership only, and usermod modifies user account properties. Question 8 A Linux system is running out of disk space on the root partition. Which command should the administrator use to identify the largest directories? A) du - sh /* | sort - h B) df - h / C) ls - la / D) find / - size +100M Answer: A Rationale: du - sh /* | sort - h displays the size of each top-level directory in human-readable format and sorts them by size. This helps identify which directories are consuming the most space. df - h / shows overall partition usage but not which directories are using space. ls - la / shows file listings but not sizes recursively. find / - size +100M finds large files but doesn't summarize directories. Question 9 Which systemd command is used to list all currently active units (services, sockets, timers, etc.)? A) systemctl list-units B) systemctl list-unit-files C) systemctl status D) systemctl show Answer: A

Rationale: systemctl list-units lists all currently active systemd units. systemctl list-unit-files shows all installed unit files regardless of their active state. systemctl status shows the status of a specific unit. systemctl show displays detailed properties of a unit. Question 10 A system administrator wants to permanently mount an NFS share at boot. Which file should be edited? A) /etc/fstab B) /etc/mtab C) /etc/exports D) /proc/mounts Answer: A Rationale: /etc/fstab (file systems table) contains the configuration for filesystems that should be mounted automatically at boot. NFS shares can be defined here with the appropriate options. /etc/mtab shows currently mounted filesystems, /etc/exports defines NFS shares to export, and /proc/mounts shows currently mounted filesystems from the kernel's perspective. Question 11 Which of the following correctly describes the difference between a hard link and a symbolic link? A) A hard link can span filesystems; a symbolic link cannot B) A hard link points to the inode; a symbolic link points to the pathname C) A hard link can point to directories; a symbolic link cannot D) A symbolic link shares the same inode as the original file Answer: B Rationale: A hard link points directly to the same inode as the original file, sharing the same data blocks. A symbolic link (symlink) points to the pathname of the target file. Hard links cannot span filesystems (they must be on the same filesystem) and cannot point to directories. Symbolic links can point to directories and can span filesystems.

C) lvcreate D) pvmove Answer: A Rationale: pvcreate initializes a disk or partition for use as a physical volume in LVM. vgcreate creates a volume group, lvcreate creates a logical volume, and pvmove moves data between physical volumes. Question 15 Which file contains the system's hostname configuration that persists across reboots? A) /etc/hostname B) /etc/hosts C) /proc/sys/kernel/hostname D) /etc/sysconfig/network Answer: A Rationale: /etc/hostname contains the static hostname of the system and persists across reboots on most modern Linux distributions. /etc/hosts contains hostname- to-IP mappings, /proc/sys/kernel/hostname is a runtime kernel parameter, and /etc/sysconfig/network is used on some older distributions. Question 16 A system administrator wants to create a new user with a specific home directory and default shell. Which command accomplishes this? A) useradd - d /home/john - s /bin/bash john B) adduser --home /home/john --shell /bin/bash john C) usermod - d /home/john - s /bin/bash john D) useradd --create-home --shell /bin/bash john Answer: A Rationale: useradd - d /home/john - s /bin/bash john creates a new user 'john' with the specified home directory and default shell. adduser is a more interactive

wrapper on some distributions. usermod modifies existing users, not creates new ones. Question 17 Which command displays the amount of free and used memory in the system in human-readable format? A) free - h B) vmstat C) top D) cat /proc/meminfo Answer: A Rationale: free - h displays memory usage in human-readable format (KB, MB, GB). vmstat displays virtual memory statistics, top shows real-time process and system information, and cat /proc/meminfo displays detailed memory information but not in as readable a format. Question 18 What is the purpose of the /etc/sudoers file? A) To store user passwords B) To define which users can run commands with elevated privileges C) To configure network interfaces D) To store system log files Answer: B Rationale: The /etc/sudoers file defines which users and groups can run commands with elevated privileges using sudo. It also specifies which commands they can run and whether a password is required. User passwords are stored in /etc/shadow, network configuration is in /etc/network/ or similar, and logs are in /var/log/.

Answer: A Rationale: usermod - aG wheel username adds the user to the 'wheel' group while preserving their existing group memberships (the - a flag appends, - G specifies the group). useradd - G sets the initial group membership but does not append. groupmod modifies groups, not users. Question 22 A system administrator wants to view the last 50 lines of a log file and follow new entries in real time. Which command should be used? A) tail - f - n 50 /var/log/syslog B) head - f - n 50 /var/log/syslog C) less +F /var/log/syslog D) cat /var/log/syslog | tail - 50 Answer: A Rationale: tail - f - n 50 /var/log/syslog displays the last 50 lines of the file and follows new entries as they are appended (-f for follow, - n 50 for last 50 lines). head shows the beginning of a file. less +F also follows a file but uses a different syntax. cat | tail only shows the last 50 lines without following. Question 23 Which file in the /proc filesystem shows the command line arguments of all running processes? A) /proc/cmdline B) /proc/self/cmdline C) /proc/[pid]/cmdline D) /proc/version Answer: C Rationale: /proc/[pid]/cmdline contains the command line arguments for the process with the specified PID. /proc/cmdline contains the kernel boot command line, and /proc/self/cmdline would show the command line of the process reading it (which is not generally useful).

Question 24 A Linux system uses GRUB2 as its bootloader. Which file is the primary configuration file for GRUB2? A) /boot/grub/grub.conf B) /boot/grub2/grub.cfg C) /etc/default/grub D) /boot/grub/menu.lst Answer: B Rationale: /boot/grub2/grub.cfg is the primary configuration file that GRUB reads at boot time. /etc/default/grub is the configuration file that users edit to generate grub.cfg (using grub2-mkconfig). grub.conf and menu.lst are associated with older GRUB (legacy) versions. Question 25 Which command is used to display the system's current date and time, and can also be used to set it? A) date B) timedatectl C) hwclock D) cal Answer: A Rationale: The date command displays the current date and time and can also be used to set it (with appropriate privileges). timedatectl is a modern systemd command for managing time settings. hwclock manages the hardware clock. cal displays a calendar. Question 26 A system administrator needs to create a new directory and all parent directories if they don't exist. Which command should be used?

system. arch shows only the machine architecture. version and kernel are not standard Linux commands. Question 29 What is the purpose of the chage command in Linux? A) To change a user's password B) To change a user's group membership C) To change password aging information for a user D) To change a user's shell Answer: C Rationale: The chage command is used to modify password aging information for a user account, including the last password change date, minimum and maximum password age, and warning period. passwd changes passwords, usermod changes group membership and shell. Question 30 A system administrator needs to list all services that are configured to start at boot time on a systemd-based system. Which command should be used? A) systemctl list-unit-files --state=enabled B) systemctl list-units --state=enabled C) service --status-all D) chkconfig --list Answer: A Rationale: systemctl list-unit-files --state=enabled lists all unit files that are enabled (configured to start at boot). systemctl list-units shows currently active units, not just enabled ones. service --status-all and chkconfig are for SysV init systems. Question 31 Which file contains the list of filesystems that are currently mounted on a Linux system?

A) /etc/fstab B) /etc/mtab C) /proc/mounts D) /var/log/messages Answer: C Rationale: /proc/mounts contains a list of all currently mounted filesystems as maintained by the kernel. /etc/fstab contains the configuration for filesystems to be mounted, not the current state. /etc/mtab is traditionally a symlink to /proc/mounts on many systems. /var/log/messages contains system logs. Question 32 A system administrator is troubleshooting a system that hangs during boot. Which kernel parameter can be added to the GRUB boot line to boot into single-user mode for troubleshooting? A) single B) s C) 1 D) All of the above Answer: D Rationale: All of these kernel parameters can be used to boot into single-user mode (runlevel 1) for troubleshooting. single, s, and 1 are all recognized by the kernel and init system to boot into single-user mode, which provides a minimal environment for troubleshooting. DOMAIN 2: SECURITY (21%) — Questions 33- 53 Question 33 Which of the following is the correct syntax to change the permissions of a file using symbolic notation to add execute permission for the owner? A) chmod u+x file.txt B) chmod +x file.txt

Question 36 Which firewall management tool is the standard interface for iptables and nftables on modern Linux distributions? A) ufw B) firewalld C) shorewall D) ipfw Answer: B Rationale: firewalld is the standard dynamic firewall management tool on many modern Linux distributions (RHEL, CentOS, Fedora). It provides a D-Bus interface and supports both iptables and nftables backends. ufw is common on Ubuntu, shorewall is another firewall tool, and ipfw is used on BSD systems. Question 37 Which of the following is the default umask value for a non-root user on most Linux systems? A) 022 B) 002 C) 077 D) 027 Answer: A Rationale: The default umask for a non-root user is typically 022. This means new files are created with permissions 644 (666 - 022) and new directories with 755 (777 - 022). Root often has a umask of 022 as well. 002 is used in some environments for shared groups, 077 is restrictive, and 027 is also restrictive. Question 38 A system administrator needs to generate a new SSH key pair for a user. Which command should be used?

A) ssh-keygen - t rsa - b 4096 B) ssh-genkey - t rsa C) openssl genrsa - out key.pem 4096 D) ssh-create-key - t rsa Answer: A Rationale: ssh-keygen - t rsa - b 4096 generates a new RSA SSH key pair with a 4096 - bit key. - t specifies the key type (rsa, ed25519, etc.), and - b specifies the key length. The other options are either incorrect commands or generate different types of keys. Question 39 Which file contains the list of trusted Certificate Authorities (CAs) on a Linux system? A) /etc/ssl/certs/ca-certificates.crt B) /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem C) /etc/ssl/certs/ca-bundle.crt D) All of the above (depending on distribution) Answer: D Rationale: The location of the system CA certificate bundle varies by distribution. Debian/Ubuntu uses /etc/ssl/certs/ca-certificates.crt, RHEL/CentOS uses /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem, and some distributions use /etc/ssl/certs/ca-bundle.crt. All are valid locations depending on the distribution. Question 40 Which of the following is a security best practice for SSH configuration? A) Disable root login B) Use password authentication only C) Keep the default SSH port (22) D) Allow all users to log in Answer: A

Question 43 Which of the following files controls the system-wide locale settings? A) /etc/locale.conf B) /etc/default/locale C) /etc/environment D) /etc/profile Answer: A Rationale: /etc/locale.conf is the system-wide locale configuration file on systemd-based systems. /etc/default/locale is used on Debian/Ubuntu. /etc/environment sets environment variables system-wide, and /etc/profile is a shell initialization file. Question 44 What is the purpose of the fail2ban utility? A) To block IP addresses after repeated failed login attempts B) To encrypt file systems C) To manage firewall rules D) To monitor system logs Answer: A Rationale: fail2ban is a security tool that monitors log files (e.g., /var/log/auth.log) for repeated failed login attempts and temporarily blocks the offending IP addresses using the firewall. It helps protect against brute-force attacks. Question 45 Which command is used to change the group ownership of a file? A) chown B) chgrp C) chmod D) groupmod Answer: B

Rationale: chgrp (change group) is used to change the group ownership of a file or directory. chown can also change group ownership when used with the :group syntax. chmod changes permissions, and groupmod modifies group properties. Question 46 Which of the following is the correct way to list all open ports and listening services on a Linux system? A) ss - tuln B) netstat - tuln C) lsof - i D) All of the above Answer: D Rationale: All three commands can be used to list open ports and listening services. ss - tuln (socket statistics) is the modern replacement for netstat. netstat - tuln is the traditional command. lsof - i lists open network files. All provide similar information. Question 47 A system administrator needs to encrypt a file using GPG with a symmetric key. Which command should be used? A) gpg - c file.txt B) gpg - e file.txt C) gpg - d file.txt.gpg D) gpg --encrypt file.txt Answer: A Rationale: gpg - c (symmetric encryption) encrypts a file using a passphrase with a symmetric cipher. gpg - e (encrypt) uses asymmetric encryption with a recipient's public key. gpg - d decrypts a file. gpg --encrypt is equivalent to - e.