πŸ”

XK0-005 β€” all questions

263 practice questions with answers and explanations.

Topic 1 Β· Question 1

An administrator accidentally deleted the /boot/vmlinuz file and must resolve the issue before the server is rebooted. Which of the following commands should the administrator use to identify the correct version of this file?

  • Arpm -qa | grep kernel; uname -a (correct answer)
  • Byum -y update; shutdown -r now
  • Ccat /etc/centos-release; rpm -Uvh --nodeps
  • Dtelinit 1; restorecon -Rv /boot
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: rpm -qa | grep kernel; uname -a

Topic 1 Β· Question 2

A cloud engineer needs to change the secure remote login port from 22 to 49000. Which of the following files should the engineer modify to change the port number to the desired value?

  • A/etc/host.conf
  • B/etc/hostname
  • C/etc/services
  • D/etc/ssh/sshd_config (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: /etc/ssh/sshd_config This option keeps traffic private / properly secured as required.

Topic 1 Β· Question 3

A new file was added to a main Git repository. An administrator wants to synchronize a local copy with the contents of the main repository. Which of the following commands should the administrator use for this task?

  • Agit reflog
  • Bgit pull (correct answer)
  • Cgit status
  • Dgit push
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: git pull

Explanation

Git provides distributed source control with branching, history, and collaborative change tracking.

Topic 1 Β· Question 4

A Linux administrator needs to redirect all HTTP traffic temporarily to the new proxy server 192.0.2.25 on port 3128. Which of the following commands will accomplish this task?

  • Aiptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128
  • Biptables -t nat -A PREROUTING -p top --dport 81 -j DNAT –-to-destination 192.0.2.25:3129
  • Ciptables -t nat -I PREROUTING -p top --sport 80 -j DNAT –-to-destination 192.0.2.25:3129
  • Diptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT –-to-destination 192.0.2.25:3128 (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT –-to-destination 192.0.2.25:3128

Explanation

Network address translation maps addresses between networks and commonly lets private hosts share public connectivity.

Topic 1 Β· Question 5

Developers have requested implementation of a persistent, static route on the application server. Packets sent over the interface eth0 to 10.0.213.5/32 should be routed via 10.0.5.1. Which of the following commands should the administrator run to achieve this goal?

  • Aroute -i etho -p add 10.0.213.5 10.0.5.1
  • Broute modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
  • Cecho "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
  • Dip route add 10.0.213.5/32 via 10.0.5.1 dev eth0 (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0

Topic 1 Β· Question 6

A user is asking the systems administrator for assistance with writing a script to verify whether a file exists. Given the following: Which of the following commands should replace the string?

Exhibit 1 for question 6
  • Aif [ -f "$filename" ]; then (correct answer)
  • Bif [ -d "$filename" ]; then
  • Cif [ -f "$filename" ] then
  • Dif [ -f "$filename" ]; while
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: if [ -f "$filename" ]; then

Topic 1 Β· Question 8

A systems administrator is deploying three identical, cloud-based servers. The administrator is using the following code to complete the task: Which of the following technologies is the administrator using?

Exhibit 1 for question 8
  • AAnsible
  • BPuppet
  • CChef
  • DTerraform (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Terraform

Topic 1 Β· Question 9

Which of the following technologies can be used as a central repository of Linux users and groups?

  • ALDAP (correct answer)
  • BMFA
  • CSSO
  • DPAM
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: LDAP

Topic 1 Β· Question 10

A systems administrator is troubleshooting connectivity issues and trying to find out why a Linux server is not able to reach other servers on the same subnet it is connected to. When listing link parameters, the following is presented: Based on the output above, which of following is the MOST probable cause of the issue?

Exhibit 1 for question 10
  • AThe address ac:00:11:22:33:cd is not a valid Ethernet address.
  • BThe Ethernet broadcast address should be ac:00:11:22:33:ff instead.
  • CThe network interface eth0 is using an old kernel module.
  • DThe network interface cable is not connected to a switch. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: The network interface cable is not connected to a switch.

Topic 1 Β· Question 11

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?

  • Apodman run -d -p 443:8443 httpd (correct answer)
  • Bpodman run -d -p 8443:443 httpd
  • Cpodman run –d -e 443:8443 httpd
  • Dpodman exec -p 8443:443 httpd
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: podman run -d -p 443:8443 httpd

Topic 1 Β· Question 12

A Linux administrator needs to analyze a failing application that is running inside a container. Which of the following commands allows the Linux administrator to enter the running container and analyze the logs that are stored inside?

  • Adocker run -ti app /bin/sh
  • Bpodman exec -ti app /bin/sh (correct answer)
  • Cpodman run -d app /bin/bash
  • Ddocker exec -d app /bin/bash
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: podman exec -ti app /bin/sh

Topic 1 Β· Question 13

A systems administrator needs to clone the partition /dev/sdc1 to /dev/sdd1. Which of the following commands will accomplish this task?

  • Atar -cvzf /dev/sdd1 /dev/sdc1
  • Brsync /dev/sdc1 /dev/sdd1
  • Cdd if=/dev/sdc1 of=/dev/sdd1 (correct answer)
  • Dscp /dev/sdc1 /dev/sdd1
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: dd if=/dev/sdc1 of=/dev/sdd1

Topic 1 Β· Question 14

When trying to log in remotely to a server, a user receives the following message: The server administrator is investigating the issue on the server and receives the following outputs: Which of the following is causing the issue?

Exhibit 1 for question 14Exhibit 2 for question 14
  • AThe wrong permissions are on the user’s home directory.
  • BThe account was locked out due to three failed logins.
  • CThe user entered the wrong password.
  • DThe user has the wrong shell assigned to the account. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: The user has the wrong shell assigned to the account.

Topic 1 Β· Question 15 Β· Select all that apply

A new Linux systems administrator just generated a pair of SSH keys that should allow connection to the servers. Which of the following commands can be used to copy a key file to remote servers? (Choose two.)

  • Awget
  • Bssh-keygen
  • Cssh-keyscan
  • Dssh-copy-id (correct answer)
  • Eftpd
  • Fscp (correct answer)
Reveal answer & explanation
Correct answer: D, F

The correct answer is D, F. Option D: ssh-copy-id Option F: scp

Topic 1 Β· Question 16

A systems administrator needs to reconfigure a Linux server to allow persistent IPv4 packet forwarding. Which of the following commands is the correct way to accomplish this task?

  • Aecho 1 > /proc/sys/net/ipv4/ipv_forward
  • Bsysctl -w net.ipv4.ip_forward=1 (correct answer)
  • Cfirewall-cmd --enable ipv4_forwarding
  • Dsystemctl start ipv4_forwarding
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: sysctl -w net.ipv4.ip_forward=1

Topic 1 Β· Question 17

A Linux administrator would like to use systemd to schedule a job to run every two hours. The administrator creates timer and service definitions and restarts the server to load these new configurations. After the restart, the administrator checks the log file and notices that the job is only running daily. Which of the following is MOST likely causing the issue?

  • AThe checkdiskspace.service is not running.
  • BThe checkdiskspace.service needs to be enabled.
  • CThe OnCalendar schedule is incorrect in the timer definition. (correct answer)
  • DThe system-daemon services need to be reloaded.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: The OnCalendar schedule is incorrect in the timer definition.

Topic 1 Β· Question 18

An administrator deployed a Linux server that is running a web application on port 6379/tcp. SELinux is in enforcing mode based on organization policies. The port is open on the firewall. Users who are trying to connect to a local instance of the web application receive Error 13, Permission denied. The administrator ran some commands that resulted in the following output: Which of the following commands should be used to resolve the issue?

Exhibit 1 for question 18
  • Asemanage port -d -t http_port_t -p tcp 6379
  • Bsemanage port -a -t http_port_t -p tcp 6379 (correct answer)
  • Csemanage port -a http_port_t -p top 6379
  • Dsemanage port -l -t http_port_tcp 6379
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: semanage port -a -t http_port_t -p tcp 6379

Topic 1 Β· Question 19

A systems administrator created a web server for the company and is required to add a tag for the API so end users can connect. Which of the following would the administrator do to complete this requirement?

  • Ahostnamectl status --no-ask-password
  • Bhostnamectl set-hostname "$(perl -le "print" "A" x 86)"
  • Chostnamectl set-hostname Comptia-WebNode -H root@192.168.2.14 (correct answer)
  • Dhostnamectl set-hostname Comptia-WebNode --transient
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: hostnamectl set-hostname Comptia-WebNode -H root@192.168.2.14

Topic 1 Β· Question 20

A systems administrator wants to back up the directory /data and all its contents to /backup/data on a remote server named remote. Which of the following commands will achieve the desired effect?

  • Ascp -p /data remote:/backup/data
  • Bssh -i /remote:/backup/ /data
  • Crsync -a /data remote:/backup/ (correct answer)
  • Dcp -r /data /remote/backup/
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: rsync -a /data remote:/backup/

Topic 1 Β· Question 21

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

  • Agit clone https://github.com/comptia/linux+-.git git push origin
  • Bgit clone https://qithub.com/comptia/linux+-.git git fetch New-Branch
  • Cgit clone https://github.com/comptia/linux+-.git git status
  • Dgit clone https://github.com/comptia/linuxt+-.git git checkout -b (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: git clone https://github.com/comptia/linuxt+-.git git checkout -b

Explanation

Git provides distributed source control with branching, history, and collaborative change tracking.

Showing questions 1–20 of 263 Β· Page 1 of 14