Practice Free XK0-005 Exam Online Questions
The application team is having issues accessing their data in their /app filesystem.
Given the following outputs:
Which of the following is the reason for this issue?
- A . The fllesystem was mounted incorrectly.
- B . The /etc/fstab configuration is wrong.
- C . A physical volume is missing.
- D . The data has been deleted.
C
Explanation:
pvs shows warning that a PV is missing.
The LVM volume vgdata-lvdata cannot be mounted.
Reference: CompTIA Linux+ XK0-005 Study Guide, Chapter 6
man pvs
An administrator wants to reorganize the /etc/sudoers configuration file by department groups.
Which of the following actions should the administrator take?
- A . Configure includedir /etc/sudoers.d directive inside /etc/sudoers file.
- B . Create a symlink in each user’s home directory to /etc/sudoers.
- C . Copy /etc/sudoers and name each group with incremental numbers (/etc/sudoers1, /etc/sudoers2).
- D . Execute setfacl commands on /etc/sudoers and add permissions for each group.
A
Explanation:
includedir /etc/sudoers.d allows modular sudo configuration.
Files under /etc/sudoers.d/ should be named per group or user and formatted like sudoers.
Reference: CompTIA Linux+ XK0-005 Study Guide, Chapter 8
man sudoers
A systems administrator wants to delete app. conf from a Git repository.
Which of the following commands will delete the file?
- A . git tag app. conf
- B . git commit app. conf
- C . git checkout app. conf
- D . git rm app. conf
D
Explanation:
To delete a file from a Git repository, the administrator can use the command git rm app.conf (D). This will remove the file “app.conf” from the working directory and stage it for deletion from the repository. The administrator can then commit the change with git commit -m "Delete app.conf" to finalize the deletion. The other commands will not delete the file, but either tag, commit, or checkout the file.
[CompTIA Linux+ Study Guide], Chapter 10: Working with Git, Section: Deleting Files with Git [How to Delete Files from Git]
A systems administrator receives a report about performance issues in a Linux production system.
Which of the following commands should the administrator use to help diagnose the performance issues?
- A . jobs
- B . renice
- C . top
- D . pkill
C
Explanation:
The top command provides a real-time, dynamic view of system performance, showing CPU, memory usage, and running processes ― essential for identifying performance bottlenecks. jobs shows background jobs in a shell session.
renice is used to change process priority but doesn’t diagnose issues. pkill terminates processes but doesn’t monitor performance.
Reference: CompTIA Linux+ XK0-005 Study Guide, Domain 5.1 C Troubleshooting Tools “top is a critical tool for real-time system performance diagnostics and process monitoring.”
A newly hired junior administrator is studying the format of the /var/log/messages file.
Which of the following commands should the administrator use to preserve the contents of the original file while also creating an identical file in the /home/admin directory?
- A . touch /var/log/messages /home/admin
- B . mv /var/log/messages /home/admin
- C . cat /var/log/messages > /home/admin/messages
- D . ln -s /var/log/messages /home/admin
C
Explanation:
Comprehensive and Detailed Step-by-Step
cat /var/log/messages > /home/admin/messages copies the file contents while preserving the original file.
touch only creates an empty file and does not copy contents.
mv moves the file instead of copying it.
ln -s creates a symbolic link but does not copy the contents.
Reference: CompTIA Linux+ Official Study Guide, Chapter on Log Management
A systems engineer is adding a new 1GB XFS filesystem that should be temporarily mounted under /ops/app.
Which of the following is the correct list of commands to achieve this goal?
A)
B)
C)
D)
- A . Option A
- B . Option B
- C . Option C
- D . Option D
D
Explanation:
The list of commands in option D is the correct way to achieve the goal.
The commands are as follows:
fallocate -l 1G /ops/app.img creates a 1GB file named app.img under the /ops directory.
mkfs.xfs /ops/app.img formats the file as an XFS filesystem. mount -o loop /ops/app.img /ops/app mounts the file as a loop device under the /ops/app directory. The other options are incorrect because they either use the wrong commands
(dd or truncate instead of fallocate), the wrong options (-t or -f instead of -o), or the wrong order of arguments (/ops/app.img /ops/app instead of /ops/app /ops/app.img). CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, pages 323-324.
A systems administrator is writing a script to analyze the number of files in the directory /opt/application/home/.
Which of the following commands should the administrator use in conjunction with ls -l | to count the files?
- A . less
- B . tail -f
- C . tr -c
- D . wc -l
A Linux administrator needs to expose port 9000 for a container to listen during runtime.
The Linux administrator creates a Dockerfile with the following entries:
sql
FROM node:9-alpine
WORKDIR /usr/src/app
COPY package.json ./
RUN npm install
COPY. .
EXPOSE 9000
CMD ["npm", "start"]
Which of the following commands should the administrator use to accomplish this task? (Select two).
- A . docker build -t Test-Container
- B . docker tag Test-Container
- C . docker inspect Test-Container
- D . docker run -p 5000:80 Test-Container
- E . docker push Test-Container
- F . docker run -p 80:9000 Test-Container
A,F
Explanation:
First, the administrator should build the container image using the command docker build -t Test-Container, which creates a Docker image with the specified configuration. To run the container and expose port 9000, the correct command is docker run -p 80:9000 Test-Container, which maps the container’s port 9000 to port 80 on the host machine, making the service accessible externally on port 80.
A DevOps engineer is working on a local copy of a Git repository. The engineer would like to switch from the main branch to the staging branch but notices the staging branch does not exist.
Which of the following Git commands should the engineer use to perform this task?
- A . git branch ―m staging
- B . git commit ―m staging
- C . git status ―b staging
- D . git checkout ―b staging
D
Explanation:
The correct answer is D. git checkout -b staging
This command will create a new branch named staging and switch to it. The git checkout command is used to switch between branches or restore files from a specific branch. The -b option is used to create a new branch if it does not exist. For example, git checkout -b staging will create and switch to the staging branch.
The other options are incorrect because:
A developer is trying to install an application remotely that requires a graphical interface for installation. The developer requested assistance to set up the necessary environment variables along with X11 forwarding in SSH.
Which of the following environment variables must be set in remote shell in order to launch the graphical interface?
- A . $RHOST
- B . SETENV
- C . $SHELL
- D . $DISPLAY
D
Explanation:
The environment variable that must be set in remote shell in order to launch the graphical interface
is $DISPLAY. This variable tells X11 applications where to display their windows on screen. It usually
has the form hostname:displaynumber.screennumber, where hostname is the name of the computer
running the X server, displaynumber is a unique identifier for an X display on that computer, and
screennumber is an optional identifier for a screen within an X display. For example, localhost:0.0
means display number 0 on the local host. If the hostname is omitted, it defaults to the local host.
The other options are not correct environment variables for launching the graphical interface.
$RHOST is a variable that stores the name of the remote host, but it is not used by X11 applications.
SETENV is a command that sets environment variables in some shells, but it is not an environment
variable itself. $SHELL is a variable that stores the name of the current shell, but it is not related to
X11 forwarding. : How to enable or disable X11 forwarding in an SSH server; How to Configure X11
Forwarding Using SSH In Linux