CompTIA Linux+QUESTIONS AND ANSWERS |
VERIFIED AND WELL DETAILED ANSWERS | PLUS
RATIONALES | GUARANTEED PASS | LATEST EXAM
UPDATE | EXAM PREP | STUDY GUIDE | PRACTICE
TEST
Domain 1: System Management (Questions 1-25)
1. Which command is used to display the current runlevel of a Linux system using Systemd?
,A) `runlevel`
B) `systemctl get-default`
C) `who -r`
D) `init --level`
Answer: B
Rationale: While `runlevel` and `who -r` can show the previous and current runlevel, `systemctl get-default` is the
modern Systemd command to show the default target (equivalent to a runlevel), which is what the system boots
into.
2. What is the primary purpose of the `/etc/fstab` file?
A) To list user accounts and their home directories.
B) To define static filesystem mounts and their options.
C) To configure network interfaces at boot.
D) To store the system's hostname and DNS settings.
Answer: B
,Rationale: The `/etc/fstab` (file system table) file is used by the `mount` command and at boot time to
automatically mount filesystems. It contains information about block devices, mount points, filesystem types, and
mount options.
3. A user needs to find all files in the `/var/log` directory that are larger than 10MB. Which command will
accomplish this?
A) `find /var/log -size +10M`
B) `ls /var/log -size +10M`
C) `grep -r "10M" /var/log`
D) `du -h /var/log | grep "10M"`
Answer: A
Rationale: The `find` command is the correct tool for searching for files based on specific criteria like size. The `-
size +10M` option tells `find` to look for files larger than (+) 10 Megabytes (M).
4. Which of the following is a valid way to change the hostname of a Linux system using Systemd?
A) `hostname new-hostname`
B) `echo "new-hostname" > /etc/hostname`
C) `hostnamectl set-hostname new-hostname`
, D) `sysctl kernel.hostname=new-hostname`
Answer: C
Rationale: `hostnamectl set-hostname` is the correct Systemd utility for permanently changing the system's
hostname. It updates the `/etc/hostname` file and the running system. Option A is temporary, and B only
changes the file without applying it to the running system.
5. What is the function of the `journalctl` command?
A) To manage system services and their dependencies.
B) To query and display logs from the Systemd journal.
C) To control user access to system resources.
D) To manage kernel modules.
Answer: B
Rationale: `journalctl` is the command-line utility for viewing logs collected by the `systemd-journald` service. It
allows for powerful filtering by time, unit, priority, and other fields.
6. Which command will display the amount of free and used memory in the system in a human-readable format?
A) `top`
VERIFIED AND WELL DETAILED ANSWERS | PLUS
RATIONALES | GUARANTEED PASS | LATEST EXAM
UPDATE | EXAM PREP | STUDY GUIDE | PRACTICE
TEST
Domain 1: System Management (Questions 1-25)
1. Which command is used to display the current runlevel of a Linux system using Systemd?
,A) `runlevel`
B) `systemctl get-default`
C) `who -r`
D) `init --level`
Answer: B
Rationale: While `runlevel` and `who -r` can show the previous and current runlevel, `systemctl get-default` is the
modern Systemd command to show the default target (equivalent to a runlevel), which is what the system boots
into.
2. What is the primary purpose of the `/etc/fstab` file?
A) To list user accounts and their home directories.
B) To define static filesystem mounts and their options.
C) To configure network interfaces at boot.
D) To store the system's hostname and DNS settings.
Answer: B
,Rationale: The `/etc/fstab` (file system table) file is used by the `mount` command and at boot time to
automatically mount filesystems. It contains information about block devices, mount points, filesystem types, and
mount options.
3. A user needs to find all files in the `/var/log` directory that are larger than 10MB. Which command will
accomplish this?
A) `find /var/log -size +10M`
B) `ls /var/log -size +10M`
C) `grep -r "10M" /var/log`
D) `du -h /var/log | grep "10M"`
Answer: A
Rationale: The `find` command is the correct tool for searching for files based on specific criteria like size. The `-
size +10M` option tells `find` to look for files larger than (+) 10 Megabytes (M).
4. Which of the following is a valid way to change the hostname of a Linux system using Systemd?
A) `hostname new-hostname`
B) `echo "new-hostname" > /etc/hostname`
C) `hostnamectl set-hostname new-hostname`
, D) `sysctl kernel.hostname=new-hostname`
Answer: C
Rationale: `hostnamectl set-hostname` is the correct Systemd utility for permanently changing the system's
hostname. It updates the `/etc/hostname` file and the running system. Option A is temporary, and B only
changes the file without applying it to the running system.
5. What is the function of the `journalctl` command?
A) To manage system services and their dependencies.
B) To query and display logs from the Systemd journal.
C) To control user access to system resources.
D) To manage kernel modules.
Answer: B
Rationale: `journalctl` is the command-line utility for viewing logs collected by the `systemd-journald` service. It
allows for powerful filtering by time, unit, priority, and other fields.
6. Which command will display the amount of free and used memory in the system in a human-readable format?
A) `top`