1
CompTIA Linux+ (XK0-005)
Advanced Practice Examination:
150 Multiple-Choice Questions
with Detailed Rationales a well
detailed one written
and graded A+ upgraded
Exam Title: CompTIA Linux+ XK0-005 Certification Practice Exam — Comprehensive Domain
Coverage with Advanced Scenario-Based Questions for IT Professionals
Domain 1: System Management (32% of Exam) — Questions 1–48
Package Management
Question 1
A Linux administrator needs to identify which installed package owns the /usr/bin/nginx binary
on a Debian-based system. Which command should the administrator use?
A. rpm -qf /usr/bin/nginx
B. dpkg -S /usr/bin/nginx
, 2
C. apt-cache search nginx
D. dpkg -L /usr/bin/nginx
-” detailed answer 100 % correct :-”B
Rationale: The dpkg -S command searches for the package that owns a specific file. Option A
uses RPM syntax, which is for Red Hat-based systems. Option C searches package repositories
rather than identifying ownership. Option D lists files installed by a package, not the reverse
lookup.
Question 2
A systems administrator wants to remove a package named httpd along with all its configuration
files on a RHEL-based system. Which command accomplishes this?
A. sudo dnf remove httpd
B. sudo dnf erase httpd
C. sudo dnf autoremove httpd
D. sudo dnf remove --purge httpd
-” detailed answer 100 % correct :-”B
Rationale: On RHEL-based systems using DNF, dnf erase is the correct command to remove a
package and its configuration files. dnf remove removes the package but may leave
configuration files. autoremove removes unused dependencies. The --purge option is used with
APT on Debian-based systems.
Question 3
After adding a new repository on a Debian-based system, what command must be run to
update the package index before installing new packages?
A. sudo apt upgrade
B. sudo apt update
C. sudo apt dist-upgrade
D. sudo apt-get install --fix-missing
-” detailed answer 100 % correct :-”B
Rationale: sudo apt update refreshes the package index from repositories. apt upgrade installs
available upgrades. dist-upgrade handles dependencies more aggressively. The --fix-
missing option attempts to correct missing packages.
, 3
Question 4
Which command displays all installed packages on a RHEL-based system in a format suitable for
scripting?
A. rpm -qa
B. dnf list installed
C. yum list installed
D. rpm -ql
-” detailed answer 100 % correct :-”A
Rationale: rpm -qa lists all installed RPM packages and is commonly used in scripts. While dnf
list installed also works, rpm -qa is more universally available and script-friendly. rpm -ql lists
files in a package, not installed packages.
Question 5
A Debian administrator needs to see detailed information about the nginx package before
installing it. Which command provides this information?
A. dpkg -I nginx
B. apt-cache show nginx
C. apt-cache policy nginx
D. dpkg -s nginx
-” detailed answer 100 % correct :-”B
Rationale: apt-cache show nginx displays detailed package information including version,
description, dependencies, and maintainer. dpkg -I works on .deb files, not package names. apt-
cache policy shows installation candidates and priorities. dpkg -s shows status of installed
packages only.
Storage and Filesystem Management
Question 6
A system administrator needs to create a new ext4 filesystem on /dev/sdb1. Which command
should be used?
, 4
A. mkfs -t ext4 /dev/sdb1
B. mkfs.ext4 /dev/sdb1
C. mke2fs -t ext4 /dev/sdb1
D. All of the above
-” detailed answer 100 % correct :-”D
Rationale: All three commands can create an ext4 filesystem. mkfs -t ext4, mkfs.ext4,
and mke2fs -t ext4 are all valid approaches. The question tests understanding that multiple
syntax options exist for the same task.
Question 7
Which command displays mounted filesystems with human-readable sizes and filesystem types?
A. df -hT
B. df -h
C. du -sh
D. lsblk -f
-” detailed answer 100 % correct :-”A
Rationale: df -hT displays disk usage in human-readable format with filesystem types. df -
h shows sizes but not filesystem types. du -sh shows directory sizes. lsblk -f displays block
devices with filesystem information but not mount points in the same format.
Question 8
A storage administrator needs to extend an LVM logical volume by 10GB. Which sequence of
commands is correct?
A. lvextend -L +10G /dev/vg01/lv01 then resize2fs /dev/vg01/lv01
B. lvresize -L +10G /dev/vg01/lv01 then xfs_growfs /mount/point
C. Both A and B are correct depending on the filesystem
D. extendlv /dev/vg01/lv01 10G
-” detailed answer 100 % correct :-”C
Rationale: After extending an LVM volume, the filesystem must be resized. For ext2/3/4,
use resize2fs. For XFS, use xfs_growfs. Option A is correct for ext4, option B is correct for XFS.
Option D uses a non-existent command.
CompTIA Linux+ (XK0-005)
Advanced Practice Examination:
150 Multiple-Choice Questions
with Detailed Rationales a well
detailed one written
and graded A+ upgraded
Exam Title: CompTIA Linux+ XK0-005 Certification Practice Exam — Comprehensive Domain
Coverage with Advanced Scenario-Based Questions for IT Professionals
Domain 1: System Management (32% of Exam) — Questions 1–48
Package Management
Question 1
A Linux administrator needs to identify which installed package owns the /usr/bin/nginx binary
on a Debian-based system. Which command should the administrator use?
A. rpm -qf /usr/bin/nginx
B. dpkg -S /usr/bin/nginx
, 2
C. apt-cache search nginx
D. dpkg -L /usr/bin/nginx
-” detailed answer 100 % correct :-”B
Rationale: The dpkg -S command searches for the package that owns a specific file. Option A
uses RPM syntax, which is for Red Hat-based systems. Option C searches package repositories
rather than identifying ownership. Option D lists files installed by a package, not the reverse
lookup.
Question 2
A systems administrator wants to remove a package named httpd along with all its configuration
files on a RHEL-based system. Which command accomplishes this?
A. sudo dnf remove httpd
B. sudo dnf erase httpd
C. sudo dnf autoremove httpd
D. sudo dnf remove --purge httpd
-” detailed answer 100 % correct :-”B
Rationale: On RHEL-based systems using DNF, dnf erase is the correct command to remove a
package and its configuration files. dnf remove removes the package but may leave
configuration files. autoremove removes unused dependencies. The --purge option is used with
APT on Debian-based systems.
Question 3
After adding a new repository on a Debian-based system, what command must be run to
update the package index before installing new packages?
A. sudo apt upgrade
B. sudo apt update
C. sudo apt dist-upgrade
D. sudo apt-get install --fix-missing
-” detailed answer 100 % correct :-”B
Rationale: sudo apt update refreshes the package index from repositories. apt upgrade installs
available upgrades. dist-upgrade handles dependencies more aggressively. The --fix-
missing option attempts to correct missing packages.
, 3
Question 4
Which command displays all installed packages on a RHEL-based system in a format suitable for
scripting?
A. rpm -qa
B. dnf list installed
C. yum list installed
D. rpm -ql
-” detailed answer 100 % correct :-”A
Rationale: rpm -qa lists all installed RPM packages and is commonly used in scripts. While dnf
list installed also works, rpm -qa is more universally available and script-friendly. rpm -ql lists
files in a package, not installed packages.
Question 5
A Debian administrator needs to see detailed information about the nginx package before
installing it. Which command provides this information?
A. dpkg -I nginx
B. apt-cache show nginx
C. apt-cache policy nginx
D. dpkg -s nginx
-” detailed answer 100 % correct :-”B
Rationale: apt-cache show nginx displays detailed package information including version,
description, dependencies, and maintainer. dpkg -I works on .deb files, not package names. apt-
cache policy shows installation candidates and priorities. dpkg -s shows status of installed
packages only.
Storage and Filesystem Management
Question 6
A system administrator needs to create a new ext4 filesystem on /dev/sdb1. Which command
should be used?
, 4
A. mkfs -t ext4 /dev/sdb1
B. mkfs.ext4 /dev/sdb1
C. mke2fs -t ext4 /dev/sdb1
D. All of the above
-” detailed answer 100 % correct :-”D
Rationale: All three commands can create an ext4 filesystem. mkfs -t ext4, mkfs.ext4,
and mke2fs -t ext4 are all valid approaches. The question tests understanding that multiple
syntax options exist for the same task.
Question 7
Which command displays mounted filesystems with human-readable sizes and filesystem types?
A. df -hT
B. df -h
C. du -sh
D. lsblk -f
-” detailed answer 100 % correct :-”A
Rationale: df -hT displays disk usage in human-readable format with filesystem types. df -
h shows sizes but not filesystem types. du -sh shows directory sizes. lsblk -f displays block
devices with filesystem information but not mount points in the same format.
Question 8
A storage administrator needs to extend an LVM logical volume by 10GB. Which sequence of
commands is correct?
A. lvextend -L +10G /dev/vg01/lv01 then resize2fs /dev/vg01/lv01
B. lvresize -L +10G /dev/vg01/lv01 then xfs_growfs /mount/point
C. Both A and B are correct depending on the filesystem
D. extendlv /dev/vg01/lv01 10G
-” detailed answer 100 % correct :-”C
Rationale: After extending an LVM volume, the filesystem must be resized. For ext2/3/4,
use resize2fs. For XFS, use xfs_growfs. Option A is correct for ext4, option B is correct for XFS.
Option D uses a non-existent command.