New (2025) Download free XK0-005 PDF for CompTIA Practice Tests
100% Free XK0-005 Files For passing the exam Quickly
CompTIA Linux+ certification exam is designed to test an individual's knowledge and skills in areas such as system configuration, management, security, and troubleshooting. XK0-005 exam consists of 90 multiple-choice and performance-based questions that must be completed within 90 minutes. The performance-based questions require candidates to perform tasks on a Linux system using command-line interfaces, which assesses their practical skills.
CompTIA XK0-005, also known as the CompTIA Linux+ Certification Exam, is a highly respected certification in the IT industry. CompTIA Linux+ Certification Exam certification is designed for individuals who have a strong understanding of Linux operating systems and want to demonstrate their knowledge and skills to potential employers. XK0-005 exam is vendor-neutral, which means that it is not specific to any particular Linux distribution, making it a highly desirable certification for those who work with different types of Linux systems.
NEW QUESTION # 216
A user created the following script file:
# ! /bin/bash
# FILENAME: /home/user/ script . sh
echo "hello world"
exit 1
However, when the user tried to run the script file using the command "script . sh, an error returned indicating permission was denied. Which of the follow-ing should the user execute in order for the script to run properly?
- A. chmod /home/user/script . sh
- B. chmod 600 /home/user/script . sh
- C. chmod 0+r /horne/user/script. sh
- D. chmod u+x /home/user/script . sh
Answer: D
Explanation:
To run a script file, the user needs to have execute permission on the file. The command chmod u+x /home/user/script.sh (A) will grant execute permission to the owner of the file, which is the user who created it. The other commands will not give execute permission to the user, and therefore will not allow the script to run properly. Reference:
[CompTIA Linux+ Study Guide], Chapter 3: Working with Files, Section: Changing File Permissions
[How to Make a Bash Script Executable]
NEW QUESTION # 217
Joe, a user, is unable to log in to the Linux system. Given the following output:
Which of the following commands would resolve the issue?
- A. chage -E 90 joe
- B. passwd -u joe
- C. pam_tally2 -u joe -r
- D. usermod -s /bin/bash joe
Answer: C
Explanation:
The command pam_tally2 -u joe -r will resolve the issue of Joe being unable to log in to the Linux system.
The pam_tally2 command is a tool for managing the login counter for the PAM (Pluggable Authentication Modules) system. PAM is a framework for managing authentication and authorization on Linux systems.
PAM allows the administrator to define the rules and policies for accessing various system resources and services, such as login, sudo, ssh, or cron. PAM also supports different types of authentication methods, such as passwords, tokens, biometrics, or smart cards. PAM can be used to implement login restrictions, such as limiting the number of failed login attempts, locking the account after a certain number of failures, or enforcing a minimum or maximum time between login attempts. The pam_tally2 command can display, reset, or unlock the login counter for the users or hosts. The -u joe option specifies the user name that the command should apply to. The -r option resets the login counter for the user. The command pam_tally2 -u joe -r will reset the login counter for Joe, which will unlock his account and allow him to log in to the Linux system.
This will resolve the issue of Joe being unable to log in to the Linux system. This is the correct command to use to resolve the issue. The other options are incorrect because they either do not unlock the account (usermod -s /bin/bash joe or passwd -u joe) or do not affect the login counter (chage -E 90 joe). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 17: Implementing Basic Security, page 517.
NEW QUESTION # 218
Which of the following Linux server roles should be installed to monitor and log local web traffic?
- A. Proxy server
- B. SSH server
- C. Name server
- D. AAA server
- E. HTTP server
Answer: A
NEW QUESTION # 219
A Linux systems administrator needs to copy files and directories from Server A to Server B. Which of the following commands can be used for this purpose? (Select TWO)
- A. cp
- B. reposync
- C. ssh
- D. rsync
- E. rsyslog
- F. scp
Answer: D,F
Explanation:
The rsync and scp commands can be used to copy files and directories from Server A to Server B. Both commands can use SSH as a secure protocol to transfer data over the network. The rsync command can synchronize files and directories between two locations, using various options to control the copying behavior. The scp command can copy files and directories between two hosts, using similar syntax as cp. The rsyslog command is used to manage system logging, not file copying. The cp command is used to copy files and directories within a single host, not between two hosts. The reposync command is used to synchronize a remote yum repository to a local directory, not copy files and directories between two hosts. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Networking Fundamentals, pages 440-441.
NEW QUESTION # 220
A user wants to list the lines of a log, adding a correlative number at the beginning of each line separated by a set of dashes from the actual message.
Which of the following scripts will complete this task?
- A.

- B.

- C.

- D.

Answer: C
Explanation:
B the command is incorrect
C need $ sign before the parameter
D need a another pair of parenthese
NEW QUESTION # 221
A systems administrator is tasked with creating a cloud-based server with a public IP address.
Which of the following technologies did the systems administrator use to complete this task?
- A. Puppet
- B. Git
- C. Terraform
- D. Ansible
Answer: C
Explanation:
Explanation
The systems administrator used Terraform to create a cloud-based server with a public IP address. Terraform is a tool for building, changing, and versioning infrastructure as code. Terraform can create and manage resources on different cloud platforms, such as AWS, Azure, or Google Cloud. Terraform uses a declarative syntax to describe the desired state of the infrastructure and applies the changes accordingly. Terraform can also assign a public IP address to a cloud server by using the appropriate resource attributes. This is the correct technology that the systems administrator used to complete the task. The other options are incorrect because they are either not designed for creating cloud servers (Puppet or Git) or not capable of assigning public IP addresses (Ansible). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19:
Managing Cloud and Virtualization Technologies, page 559.
NEW QUESTION # 222
A Linux user needs to connect to a remote email server named mail.foo.com through the SMTP port.
Which of the following commands will accomplish this task?
- A. traceroute mail.foo.com 25
- B. netcat mail.foo.com 110
- C. netcat mail.foo.com 25
- D. traceroute mail.foo.com 110
Answer: C
NEW QUESTION # 223
A systems administrator configured firewall rules using firewalld. However, after the system is rebooted, the firewall rules are not present:
The systems administrator makes additional checks:
Which of the following is the reason the firewall rules are not active?
- A. FIREWALL_ARGS has no value assigned.
- B. The firewalld service is not enabled.
- C. iptables is conflicting with firewalld.
- D. The wrong system target is activated.
Answer: B
Explanation:
Explanation
The reason the firewall rules are not active is that the firewalld service is not enabled. This means that the service will not start automatically at boot time or after a system reload. To enable the firewalld service, the systems administrator needs to use the command sudo systemctl enable firewalld. This will create a symbolic link from the firewalld service file to the appropriate systemd target, such as multi-user.target. Enabling the service does not start it immediately, so the systems administrator also needs to use the command sudo systemctl start firewalld or sudo systemctl reload firewalld to activate the firewall rules.
The other options are not correct reasons for the firewall rules not being active. iptables is not conflicting with firewalld, because firewalld uses iptables as its backend by default. The wrong system target is not activated, because firewalld is independent of the system target and can be enabled for any target. FIREWALL_ARGS has no value assigned, but this is not a problem, because FIREWALL_ARGS is an optional environment variable that can be used to pass additional arguments to the firewalld daemon, such as --debug or --nofork. If FIREWALL_ARGS is empty or not defined, firewalld will use its default arguments. References: firewalld.service(8) - Linux manual page; firewall-cmd(1) - Linux manual page; systemctl(1) - Linux manual page
NEW QUESTION # 224
A Linux administrator is troubleshooting a memory-related issue. Based on the output of the commands:
Which of the following commands would address the issue?
- A. free 8321
- B. kill -9 8321
- C. renice -10 8321
- D. top -p 8321
Answer: B
Explanation:
The command that would address the memory-related issue is kill -9 8321. This command will send a SIGKILL signal to the process with the PID 8321, which is the mysqld process that is using 99.7% of the available memory according to the top output. The SIGKILL signal will terminate the process immediately and free up the memory it was using. However, this command should be used with caution as it may cause data loss or corruption if the process was performing some critical operations.
The other options are not correct commands for addressing the memory-related issue. The top -p 8321 command will only display information about the process with the PID 8321, but will not kill it or reduce its memory usage. The renice -10 8321 command will change the priority (niceness) of the process with the PID
8321 to -10, which means it will have a higher scheduling priority, but this will not affect its memory consumption. The free 8321 command is invalid because free does not take a PID as an argument; free only displays information about the total, used, and free memory in the system. References: How to troubleshoot Linux server memory issues; kill(1) - Linux manual page
NEW QUESTION # 225
An administrator needs to look at a log for an application on a systemd-based system. There is no log for this application in /var/log. Which of the following is another way to view the application log on this system?
- A. journalctl -u application
- B. tail -f /var/log/secure
- C. watch /var/lib/application/
- D. systemctl application.service
Answer: A
Explanation:
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate- systemd-logs
NEW QUESTION # 226
A Linux administrator was asked to run a container with the httpd server inside. This container should be exposed at port 443 of a Linux host machine while it internally listens on port 8443. Which of the following commands will accomplish this task?
- A. podman exec -p 8443:443 httpd
- B. podman run -d -p 443:8443 httpd
- C. podman run -d -e 443:8443 httpd
- D. podman run -d -p 8443:443 httpd
Answer: B
Explanation:
Explanation
The command that will accomplish the task of running a container with the httpd server inside and exposing it at port 443 of the Linux host machine while it internally listens on port 8443 is podman run -d -p 443:8443
httpd. This command uses the podman tool, which is a daemonless container engine that can run and manage containers on Linux systems. The -d option runs the container in detached mode, meaning that it runs in the background without blocking the terminal. The -p option maps a port on the host machine to a port inside the container, using the format host_port:container_port. In this case, port 443 on the host machine is mapped to port 8443 inside the container, allowing external access to the httpd server. The httpd argument specifies the name of the image to run as a container, which in this case is an image that contains the Apache HTTP Server software. The other options are not correct commands for accomplishing the task. Podman run -d -p 8443:443
httpd maps port 8443 on the host machine to port 443 inside the container, which does not match the requirement. Podman run -d -e 443:8443 httpd uses the -e option instead of the -p option, which sets an environment variable inside the container instead of mapping a port. Podman exec -p 8443:443 httpd uses the podman exec command instead of the podman run command, which executes a command inside an existing container instead of creating a new one. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Automating Tasks
NEW QUESTION # 227
A systems administrator receives reports that several virtual machines in a host are responding slower than expected. Upon further investigation, the administrator obtains the following output from one of the affected systems:
Which of the following best explains the reported issue?
- A. The physical host is running out of CPU resources, leading to insufficient CPU time being allocated to virtual machines.
- B. The virtual machine is running out of CPU resources, leading to users experiencing longer response times.
- C. The virtual machine has enough CPU cycles, leading to the system use percentage being higher than expected.
- D. The physical host has enough CPU cores, leading to users running more processes to compensate for the slower response times.
Answer: B
Explanation:
Based on the output from one of the affected systems, the best explanation for the reported issue is that the virtual machine is running out of CPU resources, leading to users experiencing longer response times (D). The output shows that the system use percentage is very high (57.85%), indicating that the virtual machine is using most of its CPU cycles for system processes. This leaves little CPU time for user processes, which results in slower performance. The other explanations are not supported by the output or are contradictory.
References:
* [CompTIA Linux+ Study Guide], Chapter 8: Optimizing Linux Performance, Section: Monitoring CPU Usage
* [How to Interpret CPU Usage Statistics]
NEW QUESTION # 228
An administrator accidentally installed the httpd RPM package along with several dependencies. Which of the following options is the best way for the administrator to revert the package installation?
- A. dnf clean all
- B. yum history undo last
- C. rpm -e httpd
- D. apt-get clean
Answer: B
Explanation:
The yum history undo last command allows the administrator to undo the most recent transaction, effectively removing the httpd package and any installed dependencies. This is the safest and easiest way to revert package installations in RPM-based systems using yum.
NEW QUESTION # 229
An administrator attempts to rename a file on a server but receives the following error.
The administrator then runs a few commands and obtains the following output:
Which of the following commands should the administrator run NEXT to allow the file to be renamed by any user?
- A. chacl -R 644 files
- B. chown users files
- C. chgrp reet files
- D. chmod -t files
Answer: D
Explanation:
The command that the administrator should run NEXT to allow the file to be renamed by any user is chmod -t files. This command uses the chmod tool, which is used to change file permissions and access modes. The -t option removes (or sets) the sticky bit on a directory, which restricts deletion or renaming of files within that directory to only their owners or root. In this case, since files is a directory with sticky bit set (indicated by t in drwxrwxrwt), removing it will allow any user to rename or delete files within that directory.
The other options are not correct commands for allowing any user to rename files within files directory. The chgrp reet files command will change the group ownership of files directory to reet, but it will not affect its permissions or access modes. The chacl -R 644 files command is invalid, as chacl is used to change file access control lists (ACLs), not permissions or access modes. The chown users files command will change the user ownership of files directory to users, but it will not affect its permissions or access modes. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 8: Managing Users and Groups; chmod(1) - Linux manual page
NEW QUESTION # 230
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/sdb /media/usb
- C. mount /dev/sdb0 /media/usb
- D. mount -t usb /dev/sdb1 /media/usb
Answer: A
NEW QUESTION # 231
A Linux administrator is troubleshooting an issue in which an application service failed to start on a Linux server. The administrator runs a few commands and gets the following outputs:
Based on the above outputs, which of the following is the MOST likely action the administrator should take to resolve this issue?
- A. Enable the logsearch.service and restart the service.
- B. Increase the TimeoutStartUSec configuration for the logsearch.sevice.
- C. Update the KillSignal configuration for the logsearch.service to use TERM.
- D. Update the OnCalendar configuration to schedule the start of the logsearch.service.
Answer: B
NEW QUESTION # 232
A systems administrator documents the instructions on the internal wiki regarding how to turn the company's code into Debian packages. The instructions include the commands used to compile, what tests need to be run, the commands to convert the raw code into a package that apt or dpkg can manage, as well as an explanation of each command.
Which of the following is this an example of?
- A. Configuration management
- B. Attributes
- C. Infrastructure as code
- D. Procedures
Answer: D
Explanation:
The instructions on the internal wiki regarding how to turn the company's code into Debian packages.
NEW QUESTION # 233
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 status - B. git clone https://github.com/comptia/linuxt+-.git
git checkout -b <new-branch> - C. git clone https://github.com/comptia/linux+-.git
git push origin - D. git clone https://qithub.com/comptia/linux+-.git
git fetch New-Branch
Answer: B
NEW QUESTION # 234
An administrator is running a web server in a container named web, but none of the error output is not showing. Which of the following should the administrator use to generate the errors on the container?
- A. docker run --name WEB --volume/dev/stdout:/var/log/nginx/error.log
- B. docker-compose inspect WEB
- C. docker logs WEB
- D. docker ps WEB -f
Answer: C
Explanation:
The docker logs command is used to fetch the logs of a container. If the error output is not showing for a running container, the docker logs command can be used to view these details.
NEW QUESTION # 235
Which of the following commands will let a Linux user know the PCI devices that are installed in the system?
- A. lspci
- B. cat /proc/sys/dev
- C. lsdev
- D. cat /proc/devices/pci
Answer: A
Explanation:
https://opensource.com/article/19/9/linux-commands-hardware-information
NEW QUESTION # 236
The group named support is unable to make changes to the config file. An administrator is reviewing the permissions and sees the following:
S Is -1 config
-rw-rw----. 1 root app 4682 02-15 11:25 config
Which of the following should the administrator execute in order to give the support group access to modify the file while preserving the current ownership?
- A. setfacl -m g:support:rw- config
- B. chmod g+s config
- C. chmod 664 config
- D. chown :support config
Answer: C
Explanation:
To give the support group access to modify the config file while preserving the current ownership, the administrator can execute the command chmod 664 config . This will change the permissions of the config file to read and write for the owner and group, and read only for others. The owner and group of the file will remain as root and app respectively. The other commands will not achieve this task, but either change the group ownership, set an access control list, or set a setgid bit. Reference:
[CompTIA Linux+ Study Guide], Chapter 3: Working with Files, Section: Changing File Permissions
[How to Use chmod Command in Linux]
NEW QUESTION # 237
A Linux administrator needs to prevent the Postfix mail transfer agent from starting on boot.
Which of the following commands will accomplish this task?
- A. /etc/init.d/postfix stop
- B. systemctl stop postfix.service
- C. systemctl disable postfix.service
- D. /etc/init.d/postfix disable
Answer: C
Explanation:
The task is to "prevent the postfix mail transfer agent from starting on boot" and systemctl disable postfix.service would accomplish that where simply stopping the service would not.
NEW QUESTION # 238
A junior administrator is trying to set up a passwordless SSH connection to one of the servers. The administrator follows the instructions and puts the key in the authorized_key file at the server, but the administrator is still asked to provide a password during the connection.
Given the following output:
Which of the following commands would resolve the issue and allow an SSH connection to be established without a password?
- A. chmod 600 mv .ssh/authorized_key
- B. restorecon -rv .ssh/authorized_key
- C. mv .ssh/authorized_key .ssh/authorized_keys
- D. systemctl restart sshd.service
Answer: C
NEW QUESTION # 239
A new drive was recently added to a Linux system. Using the environment and tokens provided, complete the following tasks:
* Create an appropriate device label.
* Format and create an ext4 file system on the new partition.
The current working directory is /.
Answer:
Explanation:
Explanation:
To create an appropriate device label, format and create an ext4 file system on the new partition, you can use the following commands:
* To create a GPT (GUID Partition Table) label on the new drive /dev/sdc, you can use the parted command with the -s option (for script mode), the device name (/dev/sdc), the mklabel command, and the label type (gpt). The command is:
parted -s /dev/sdc mklabel gpt
* To create a primary partition of 10 GB on the new drive /dev/sdc, you can use the parted command with the -s option, the device name (/dev/sdc), the mkpart command, the partition type (primary), the file system type (ext4), and the start and end points of the partition (1 and 10G). The command is:
parted -s /dev/sdc mkpart primary ext4 1 10G
* To format and create an ext4 file system on the new partition /dev/sdc1, you can use the mkfs command with the file system type (ext4) and the device name (/dev/sdc1). The command is:
mkfs.ext4 /dev/sdc1
You can verify that the new partition and file system have been created by using the lsblk command, which will list all block devices and their properties.
NEW QUESTION # 240
......
The latest version, the CompTIA XK0-005 Certification Exam, was released in April 2021. XK0-005 exam covers a broad range of topics, including file systems and storage, shells and scripting, networking, virtualization and cloud computing, and security. Successful completion of the exam demonstrates the individual's proficiency in working with Linux systems, architectures, and applications.
XK0-005 Premium Exam Engine - Download Free PDF Questions: https://simplilearn.lead1pass.com/CompTIA/XK0-005-practice-exam-dumps.html