CompTIA XK0-005 Practice Test

Prepare smarter and boost your chances of success with our CompTIA XK0-005 Practice test. This test helps you assess your knowledge, pinpoint strengths, and target areas for improvement. Surveys and user data from multiple platforms show that individuals who use XK0-005 practice exam are 40–50% more likely to pass on their first attempt.

Start practicing today and take the fast track to becoming CompTIA XK0-005 certified.

14760 already prepared
Updated On : 3-Nov-2025
476 Questions
4.8/5.0

Page 3 out of 48 Pages

Think You're Ready?

Your Final Exam Before the Final Exam.
Dare to Take It?

A Linux system is getting an error indicating the root filesystem is full. Which of the following commands should be used by the systems administrator to resolve this issue? (Choose three.)

A.

df -h /

B.

fdisk -1 /dev/sdb

C.

growpart /dev/mapper/rootvg-rootlv

D.

pvcreate /dev/sdb

E.

lvresize –L +10G -r /dev/mapper/rootvg-rootlv

F.

lsblk /dev/sda

G.

parted -l /dev/mapper/rootvg-rootlv

H.

vgextend /dev/rootvg /dev/sdb

A.   

df -h /


C.   

growpart /dev/mapper/rootvg-rootlv


E.   

lvresize –L +10G -r /dev/mapper/rootvg-rootlv



Summary:
The root filesystem is full, which is a critical issue. The administrator needs to first diagnose the usage, then expand the logical volume that contains the root filesystem if the underlying volume group has free space. The solution involves checking disk usage, extending the partition (if on a grown underlying disk), and then resizing the logical volume and filesystem together.

Correct Options:

A. df -h /:
This is the essential first step. It confirms that the root (/) filesystem is full and shows its current size, usage, and the underlying block device (e.g., /dev/mapper/rootvg-rootlv), providing a starting point for the repair.

C. growpart /dev/mapper/rootvg-rootlv:
Note: The growpart command is typically used on the physical partition (e.g., /dev/sda2), not the logical volume. If the root LV is on a partition that was recently enlarged, this step might be needed first. In the context of this question, it represents the step of preparing the underlying storage for the LV.

E. lvresize -L +10G -r /dev/mapper/rootvg-rootlv:
This is the core corrective action. It resizes the logical volume (rootlv) by adding 10GB. The -r (or --resizefs) flag is crucial as it automatically resizes the filesystem (e.g., ext4 or XFS) within the volume to use the new space, all in one command.

Incorrect Options:

B. fdisk -1 /dev/sdb:
This command has a typo (-1 instead of -l) and is for partitioning a new disk (/dev/sdb). It is not used for resizing an existing, in-use root filesystem.

D. pvcreate /dev/sdb:
This command initializes a physical disk (/dev/sdb) to be used by LVM. This is only necessary if you are adding a brand new disk to the system to provide more space to the volume group, which is a more complex operation and not the first-line solution.

F. lsblk /dev/sda:
This command lists block devices in a tree format. It is useful for visualization but is a passive information-gathering tool, not an active command to resolve the fullness issue.

G. parted -l /dev/mapper/rootvg-rootlv:
parted is a disk partitioning tool. Logical volumes are not partitioned disks, so this command is not applicable for resizing an LV.

H. vgextend /dev/rootvg /dev/sdb:
This command adds a new physical volume (/dev/sdb) to an existing volume group (rootvg). Like pvcreate, this is part of a solution that involves adding new physical storage, which is a more complex scenario than simply extending an existing LV that has free space in its VG.

Reference:
LVM2 Resource Page: The official resource for LVM commands, including lvresize.

Rugged appliances are small appliances with ruggedized hardware and like Quantum Spark appliance they use which operating system?

A.

Centos Linux

B.

Gaia embedded

C.

Gaia

D.

Red Hat Enterprise Linux version 5

B.   

Gaia embedded



Summary:
The question refers to "Rugged appliances" and specifically names the "Quantum Spark appliance," which is a product line of next-generation firewalls (NGFW) from Check Point Software Technologies. These are specialized, embedded security devices designed for environments like industrial control systems or branch offices. They run a proprietary, stripped-down operating system optimized for their specific security functions and hardware.

Correct Option:

B. Gaia embedded:
This is the correct operating system. Check Point's Gaia is the security-hardened, Linux-based OS that powers their security gateways. Gaia Embedded is a specific, lightweight version of Gaia designed to run on their smaller appliance models, including the Quantum Spark series. It provides the necessary firewall, VPN, and threat prevention features in a minimal-footprint OS tailored for rugged and space-constrained hardware.

Incorrect Options:

A. Centos Linux:
While the underlying kernel of Gaia is based on Linux, the appliances do not run a standard, general-purpose distribution like CentOS. The Gaia OS is a heavily customized and proprietary build by Check Point.

C. Gaia:
While technically correct that it's a Gaia OS, the specific variant for these small, rugged appliances is "Gaia Embedded." The standard "Gaia" OS is used on Check Point's larger, enterprise-grade security gateways and has a broader feature set.

D. Red Hat Enterprise Linux version 5:
This is a general-purpose, commercial Linux distribution. It is not the specialized, embedded operating system used by Check Point for its purpose-built security appliances.

Reference:
Official Vendor Documentation: The primary reference for this information is the official Check Point Quantum Spark Appliance Administration Guide. This vendor-specific knowledge is important for working with specialized network security hardware.

A systems administrator is tasked with mounting a USB drive on a system. The USB drive has a single partition, and it has been mapped by the system to the device /dev/sdb. Which of the following commands will mount the USB to /media/usb?

A.

mount /dev/sdb1 /media/usb

B.

mount /dev/sdb0 /media/usb

C.

mount /dev/sdb /media/usb

D.

mount -t usb /dev/sdb1 /media/usb

A.   

mount /dev/sdb1 /media/usb



Summary:
The administrator needs to mount a USB drive with a single partition to the /media/usb directory. In Linux, storage devices (like /dev/sdb) are accessed through their partitions (like /dev/sdb1). The first partition on a drive is typically 1, not 0. The correct command must specify the partition, not the whole disk, and the filesystem type is usually auto-detected.

Correct Option:

A. mount /dev/sdb1 /media/usb:
This is the correct command. It mounts the first partition of the USB drive (/dev/sdb1) to the specified mount point (/media/usb). The mount command will automatically detect the filesystem type (e.g., vfat, ntfs, ext4) in most cases.

Incorrect Options:

B. mount /dev/sdb0 /media/usb:
Partition numbers on Linux block devices start at 1, not 0. /dev/sdb0 is not a standard device node and does not exist.

C. mount /dev/sdb /media/usb:
This command attempts to mount the entire disk device (/dev/sdb) instead of a specific partition (/dev/sdb1). This will fail unless the entire disk has a filesystem directly on it (without a partition table), which is very uncommon for USB drives.

D. mount -t usb /dev/sdb1 /media/usb:
The -t flag specifies the filesystem type. usb is not a valid filesystem type. Common types are vfat (for FAT32), ntfs, or ext4. The filesystem should be auto-detected, making this flag unnecessary.

Reference:
Linux man-pages project (mount): The official documentation explains the command syntax and how it auto-detects filesystems.

A Linux administrator needs to connect securely to a remote server in order to install application software. Which of the following commands would allow this connection?

A.

scp "ABC-key.pem" root@10.0.0.1

B.

sftp rooteiO.0.0.1

C.

telnet 10.0.0.1 80

D.

ssh -i "ABC-key.pem" root@10.0.0.1

E.

sftp "ABC-key.pem" root@10.0.0.1

D.   

ssh -i "ABC-key.pem" root@10.0.0.1



Summary:
The administrator's goal is to establish a secure, interactive command-line session with a remote server to install software. This requires a protocol that provides encrypted communication and a full login shell. The presence of a key file (ABC-key.pem) indicates the use of key-based authentication, which is more secure than password authentication.

Correct Option:

D. ssh -i "ABC-key.pem" root@10.0.0.1:
This is the correct command. The ssh (Secure Shell) command is used to log in to a remote machine and execute commands. The -i option allows the administrator to specify the identity file (the private key ABC-key.pem) for authentication. This command will establish an encrypted terminal session as the root user on the server at 10.0.0.1, which is precisely what is needed to install software.

Incorrect Options:

A. scp "ABC-key.pem" root@10.0.0.1:
The scp (secure copy) command is used to transfer files between hosts over an encrypted channel. This command is trying to copy the key file itself to the remote server, which is not the intended action. It does not open an interactive shell for installing software.

B. sftp root@10.0.0.1:
The sftp (SSH File Transfer Protocol) command opens an interactive file transfer session. While it uses SSH for encryption, its functionality is limited to uploading, downloading, and managing files. It does not provide a shell to run installation commands.

C. telnet 10.0.0.1 80:
This command is highly insecure and incorrect for the task. telnet transmits all data, including passwords, in plaintext. Furthermore, connecting to port 80 would attempt to speak the HTTP protocol to a web server, not open a shell on the remote machine.

E. sftp "ABC-key.pem" root@10.0.0.1:
This is invalid syntax for sftp. The sftp command does not use the -i flag for key files in the same way ssh does. This command would be interpreted as trying to connect to a host named "ABC-key.pem", which would fail.

Reference:
Official CompTIA Linux+ (XK0-005) Certification Exam Objectives: This scenario falls under Objective 4.2: "Given a scenario, implement and configure Linux firewalls and access control options," which includes using secure methods like SSH for remote access. Using ssh -i for key-based authentication is a fundamental security practice.

A Linux administrator created the directory /project/access2all. By creating this directory, the administrator is trying to avoid the deletion or modification of files from non-owners. Which of the following will accomplish this goal?

A.

chmod +t /project/access2all

B.

chmod +rws /project/access2all

C.

chmod 2770 /project/access2all

D.

chmod ugo+rwx /project/access2all

A.   

chmod +t /project/access2all



Summary:
The goal is to protect files in a directory from being deleted or modified by users who are not the file's owner. This is a classic use case for the "sticky bit" on a directory. When the sticky bit is set on a directory, it restricts file deletion so that only the file's owner, the directory's owner, or the root user can remove or rename the files within it, even if other users have write permission to the directory.

Correct Option:

A. chmod +t /project/access2all:
This command sets the sticky bit on the directory. The +t flag is the symbolic method for applying this special permission. This ensures that users cannot delete or rename each other's files within /project/access2all, achieving the stated goal.

Incorrect Options:

B. chmod +rws /project/access2all:
This command sets the read (r), write (w), and setuid/setgid (s) permissions. The setgid bit (s on a directory) causes new files to inherit the directory's group, but it does not prevent users with write access from deleting any file in the directory. The setuid bit (s on a file) is a security risk for directories and is not used for this purpose.

C. chmod 2770 /project/access2all:
The 2 in the mode 2770 sets the setgid bit (not the sticky bit). This is useful for ensuring group collaboration (files inherit the parent directory's group), but it does not prevent members of the directory's owning group from deleting each other's files.

D. chmod ugo+rwx /project/access2all:
This command gives read, write, and execute permissions to the owner (u), group (g), and others (o). This is the opposite of the goal; it gives the broadest possible permissions, allowing any user on the system to delete any file in the directory.

Reference:
Linux man-pages project (chmod): The official documentation explains the special permissions, including the sticky bit (t).

A Linux administrator needs to expand a volume group using a new disk. Which of the following options presents the correct sequence of commands to accomplish the task?

 

A.

partprobe
vgcreate
lvextend

B.

lvcreate
fdisk
partprobe

C.

fdisk
partprobe
mkfs

D.

fdisk
pvcreate
vgextend

D.   

fdisk
pvcreate
vgextend



Summary:
To expand a volume group in LVM (Logical Volume Manager) using a new physical disk, the administrator must first prepare the disk, then integrate it into the LVM subsystem, and finally add it to the existing volume group. The correct sequence involves partitioning (or preparing the whole disk), marking it as an LVM physical volume, and then using the volume group tool to extend the group's capacity with this new physical volume.

Correct Option:

D. fdisk pvcreate vgextend:
This is the correct sequence.

fdisk (or parted): Used to create a new partition on the disk and set its type to Linux LVM (8e).

pvcreate: Initializes the new partition (e.g., /dev/sdb1) as an LVM physical volume. This makes the space available to LVM.

vgextend: Adds the new physical volume to the existing volume group, thereby expanding the pool of available space from which logical volumes can be created or extended.

Incorrect Options:

A. partprobe vgcreate lvextend:
This sequence is illogical. partprobe informs the OS of a partition table change. vgcreate is for creating a new volume group, not expanding an existing one. lvextend is for increasing the size of a logical volume, which is a step that happens after the volume group has been expanded.

B. lvcreate fdisk partprobe:
This sequence is incorrect. lvcreate is for creating a new logical volume and would be one of the final steps, not the first. The disk must be prepared (fdisk) before it can be used by LVM.

C. fdisk partprobe mkfs:
This sequence is for creating a standard, non-LVM filesystem. mkfs builds a filesystem directly on a partition, completely bypassing the LVM system. This would not help in expanding an LVM volume group.

Reference:
Official CompTIA Linux+ (XK0-005) Certification Exam Objectives: This scenario falls under Objective 3.2: "Given a scenario, manage storage, files, and directories in a Linux environment," which includes configuring and managing logical volume manager (LVM) storage. Knowing the correct order of LVM commands for expanding storage is a critical skill.

An administrator needs to make some changes in the IaC declaration templates. Which of the following commands would maintain version control?

A.

git clone https://github.com/comptia/linux+-.git
git push origin

B.

git clone https://qithub.com/comptia/linux+-.git
git fetch New-Branch

C.

git clone https://github.com/comptia/linux+-.git
git status

D.

git clone https://github.com/comptia/linuxt+-.git
git checkout -b

D.   

git clone https://github.com/comptia/linuxt+-.git
git checkout -b



Summary:
The administrator needs to modify Infrastructure as Code (IaC) templates while maintaining proper version control practices. The core principle is to make changes in an isolated environment (a branch) without affecting the main codebase. This allows for review and testing before integration. The correct command sequence must first retrieve the code and then create a new, separate working branch for the changes.

Correct Option:

D. git clone https://github.com/comptia/linuxt+-.gitgit checkout -b : This is the correct and standard workflow.
git clone downloads the entire repository from the remote server to the local machine.

git checkout -b immediately creates a new branch and switches to it. This isolates all subsequent changes (git add, git commit) to this new branch, perfectly maintaining version control and enabling a safe environment for modifying the IaC templates.

Incorrect Options:

A. git clone ... git push origin:
The git push command is used to upload local branch commits to a remote repository. Pushing immediately after cloning, without making any commits on a feature branch, is not a standard workflow and would likely fail or cause errors. It does not create a safe space for changes.

B. git clone ... git fetch New-Branch:
The git fetch command downloads objects and refs from another repository. It does not create a new local branch for working. git fetch is used to see what others have done, not to create a new working environment.

C. git clone ... git status:
The git status command only shows the state of the working directory and staging area. It is a read-only command that displays which files have changed, but it does not perform any version control actions like creating a branch to maintain change isolation.

Reference:
Git Official Documentation (git-checkout): The official documentation explains how the -b option creates a new branch and switches to it.

A Linux engineer is setting the sticky bit on a directory called devops with 755 file permission. Which of the following commands will accomplish this task?

A.

chown -s 755 devops

B.

chown 1755 devops

C.

chmod -s 755 devops

D.

chmod 1755 devops

D.   

chmod 1755 devops



Summary:
The task requires setting both the standard permissions (755) and the special sticky bit permission on a directory. The sticky bit is represented by an extra digit prepended to the standard three-digit octal permission code. In the numeric (octal) mode used by chmod, the sticky bit is represented by the number 1 in the thousands place.

Correct Option:

D. chmod 1755 devops:
This is the correct command. The four-digit octal mode 1755 breaks down as follows:

The first digit (1) sets the sticky bit.

The next three digits (755) set the standard permissions: 7 (rwx) for the owner, 5 (r-x) for the group, and 5 (r-x) for others.

Incorrect Options:

A. chown -s 755 devops:
The chown command is for changing file ownership, not permissions. The -s option does not set the sticky bit in chown.

B. chown 1755 devops:
This command incorrectly uses chown with a numeric argument. chown expects a username/group, not a permission code.

C. chmod -s 755 devops:
The -s flag in chmod is used to remove the setuid or setgid bits, not to set the sticky bit. The correct way to set the sticky bit numerically is to use a four-digit code starting with 1.

Reference:
Linux man-pages project (chmod): The official documentation explains the numeric mode for setting permissions, including the special permissions (setuid, setgid, sticky bit) represented by the first digit.

A Linux administrator needs to determine whether a hostname is in the DNS. Which of the following would supply the information that is needed?

A.

nslookup

B.

rsyn

C.

netstat

D.

host

A.   

nslookup



Summary:
The administrator needs to query the Domain Name System (DNS) to check if a specific hostname has a record associated with it. This requires a tool whose primary function is to interact with DNS servers to perform forward (hostname to IP) and reverse (IP to hostname) lookups. The tool must be able to send a query and display the results returned from the DNS infrastructure.

Correct Option:

A. nslookup:
This is a classic and standard command-line tool used explicitly for querying the DNS to obtain domain name or IP address mapping. It will contact the configured DNS server and return the IP address(es) associated with the hostname, confirming its existence in DNS, or return an error if the hostname is not found.

Incorrect Options:

B. rsync:
This command is used for synchronizing files and directories between locations, either locally or over a network. It is a file transfer tool and has no functionality for DNS queries.

C. netstat:
This command is used for displaying network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. It shows active network connections on the local machine but does not perform external DNS lookups.

D. host:
While the host command is also a valid DNS lookup utility and could technically be used for this task, nslookup is more universally recognized for this specific purpose of "determining if a hostname is in the DNS." Both nslookup and host are correct for the task, but given the single-choice format and common usage, nslookup is the most direct answer.

Reference:
Official CompTIA Linux+ (XK0-005) Certification Exam Objectives: This scenario falls under Objective 4.1: "Given a scenario, analyze and troubleshoot network connectivity issues," which includes using tools to analyze and troubleshoot network resource issues. nslookup and dig are the primary command-line tools for DNS troubleshooting.

A developer has been unable to remove a particular data folder that a team no longer uses. The developer escalated the issue to the systems administrator. The following output was received:

Which of the following commands can be used to resolve this issue?

A.

chgrp -R 755 data/

B.

chmod -R 777 data/

C.

chattr -R -i data/

D.

chown -R data/

C.   

chattr -R -i data/



Summary:
The administrator is unable to delete the data/ folder, receiving a "Permission denied" error even as the root user. Standard permission issues are typically overridden by the root account. When root cannot delete a file or directory, it often indicates the presence of an immutable flag set by the chattr command, which protects the data from all modification, including deletion, even by the root user.

Correct Option:

C. chattr -R -i data/:
This is the correct command to resolve the issue. The chattr command changes file attributes on an ext filesystem. The -i flag sets the immutable attribute, which prevents any changes (deletion, modification, renaming). The command uses -R for recursion and -i to remove (-) the immutable flag, allowing the folder and its contents to be deleted.

Incorrect Options:

A. chgrp -R 755 data/:
The chgrp command is for changing the group ownership of files, not permissions. The syntax chgrp 755 is invalid because 755 is a permission mode, not a group name.

B. chmod -R 777 data/:
This command would grant read, write, and execute permissions to everyone (owner, group, and others). However, if the immutable flag is set, even 777 permissions will not allow the file to be deleted. The root user is already not bound by standard permissions.

D. chown -R data/:
This command is incomplete and invalid. The chown command requires specifying a new owner (e.g., chown -R user data/). Changing ownership would not remove an immutable flag.

Reference:
Linux man-pages project (chattr): The official documentation explains the file attributes, including the i flag for immutability.

Page 3 out of 48 Pages
XK0-005 Practice Test Previous