XK0-005: CompTIA Linux+ Topic 3
Question #: 101
Topic #: 1
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
Selected Answer: D
Question #: 102
Topic #: 1
A server is experiencing intermittent connection issues. Some connections to the Internet work as intended, but some fail as if there is no connectivity. The systems administrator inspects the server configuration:
Which of the following is MOST likely the cause of the issue?
A. An internal-only DNS server is configured.
B. The IP netmask is wrong for ens3.
C. Two default routes are configured.
D. The ARP table contains incorrect entries.
Selected Answer: B
Question #: 103
Topic #: 1
A cloud engineer needs to block the IP address 192.168.10.50 from accessing a Linux server. Which of the following commands will achieve this goal?
A. iptables -F INPUT -j 192.168.10.50 -m DROP
B. iptables -A INPUT -s 192.168.10.30 -j DROP
C. iptables -i INPUT –ipv4 192.168.10.50 -z DROP
D. iptables -j INPUT 192.168.10.50 -p DROP
Selected Answer: B
Question #: 104
Topic #: 1
A Linux systems administrator is configuring a new filesystem that needs the capability to be mounted persistently across reboots. Which of the following commands will accomplish this task? (Choose two.)
A. df -h /data
B. mkfs.ext4 /dev/sdc1
C. fsck /dev/sdc1
D. fdisk -l /dev/sdc1
E. echo “/data /dev/sdc1 ext4 defaults 0 0” >> /etc/fstab
F. echo “/dev/sdc1 /data ext4 defaults 0 0” >> /etc/fstab
Selected Answer: BF
Question #: 105
Topic #: 1
A Linux administrator is alerted to a storage capacity issue on a server without a specific mount point or directory. Which of the following commands would be MOST helpful for troubleshooting? (Choose two.)
A. parted
B. df
C. mount
D. du
E. fdisk
F. dd
G. ls
Selected Answer: BD
Question #: 106
Topic #: 1
A systems administrator pressed Ctrl+Z after starting a program using the command line, and the shell prompt was presented. In order to go back to the program, which of the following commands can the administrator use?
A. fg
B. su
C. bg
D. ed
Selected Answer: A
Question #: 107
Topic #: 1
A systems administrator received a notification that a system is performing slowly. When running the top command, the systems administrator can see the following values:
Which of the following commands will the administrator most likely run NEXT?
A. vmstat
B. strace
C. htop
D. lsof
Selected Answer: A
Question #: 108
Topic #: 1
Which of the following technologies provides load balancing, encryption, and observability in containerized environments?
A. Virtual private network
B. Sidecar pod
C. Overlay network
D. Service mesh
Selected Answer: D
Question #: 109
Topic #: 1
A development team asks an engineer to guarantee the persistency of journal log files across system reboots. Which of the following commands would accomplish this task?
A. grep -i auto /etc/systemd/journald.conf && systemctl restart systemd-journald.service
B. cat /etc/systemd/journald.conf | awk ‘(print $1,$3)’
C. sed -i ‘s/auto/persistent/g’ /etc/systemd/journald.conf && sed -i ‘persistent/s/ˆ#//q’ /etc/systemd/journald.conf
D. journalctl –list-boots && systemctl restart systemd-journald.service
Selected Answer: C
Question #: 110
Topic #: 1
A systems administrator is receiving tickets from users who cannot reach the application app that should be listening on port 9443/tcp on a Linux server.
To troubleshoot the issue, the systems administrator runs netstat and receives the following output:
Based on the information above, which of the following is causing the issue?
A. The IP address 0.0.0.0 is not valid.
B. The application is listening on the loopback interface.
C. The application is listening on port 1234.
D. The application is not running.
Selected Answer: B
Question #: 111
Topic #: 1
A systems administrator is troubleshooting a connectivity issue pertaining to access to a system named db.example.com. The system IP address should be 192.168.20.88. The administrator issues the dig command and receives the following output:
The administrator runs grep db.example.com /etc/hosts and receives the following output:
Given this scenario, which of the following should the administrator do to address this issue?
A. Modify the /etc/hosts file and change the db.example.com entry to 192.168.20.89.
B. Modify the /etc/network file and change the db.example.com entry to 192.168.20.88.
C. Modify the /etc/network file and change the db.example.com entry to 192.168.20.89.
D. Modify the /etc/hosts file and change the db.example.com entry to 192.168.20.88.
Selected Answer: D
Question #: 112
Topic #: 1
Users have been unable to reach www.comptia.org from a Linux server. A systems administrator is troubleshooting the issue and does the following:
Based on the information above, which of the following is causing the issue?
A. The name www.comptia.org does not point to a valid IP address.
B. The server 192.168.168.53 is unreachable.
C. No default route is set on the server.
D. The network interface eth0 is disconnected.
Selected Answer: C
Question #: 113
Topic #: 1
A systems technician is working on deploying several microservices to various RPM-based systems, some of which could run up to two hours. Which of the following commands will allow the technician to execute those services and continue deploying other microservices within the same terminal section?
A. gedit & disown
B. kill 9 %1
C. fg %1
D. bg %1 job name
Selected Answer: D
Question #: 114
Topic #: 1
A Linux administrator was notified that a virtual server has an I/O bottleneck. The Linux administrator analyzes the following output:
Given there is a single CPU in the sever, which of the following is causing the slowness?
A. The system is running out of swap space.
B. The CPU is overloaded.
C. The memory is exhausted.
D. The processes are paging.
Selected Answer: B
Question #: 115
Topic #: 1
Employees in the finance department are having trouble accessing the file /opt/work/file. All IT employees can read and write the file. Systems administrator reviews the following output:
Which of the following commands would permanently fix the access issue while limiting access to IT and finance department employees?
A. chattr +i file
B. chown it:finance file
C. chmod 666 file
D. setfacl -m g:finance:rw file
Selected Answer: D
Question #: 116
Topic #: 1
A Linux engineer needs to create a custom script, cleanup.sh, to run at boot as part of the system services. Which of the following processes would accomplish this task?
A. Create a unit file in the /etc/default/ directory.
systemctl enable cleanup
systemctl is-enabled cleanup
B. Create a unit file in the /etc/ske1/ directory.
systemctl enable cleanup
systemctl is-enabled cleanup
C. Create a unit file in the /etc/systemd/system/ directory.
systemctl enable cleanup
systemctl is-enabled cleanup
D. Create a unit file in the /etc/sysctl.d/ directory.
systemctl enable cleanup
systemctl is-enabled cleanup
Selected Answer: C
Question #: 117
Topic #: 1
A Linux system is failing to boot. The following error is displayed in the serial console:
[[1;33mDEPEND[Om] Dependency failed for /data.
[[1;33mDEPEND[Om] Dependency failed for Local File Systems
…
Welcome to emergency mode! After logging in, type “journalctl -xb” to viewsystem logs, “systemctl reboot” to reboot, “systemctl default” to try again to boot into default mode.
Give root password for maintenance
(or type Control-D to continue}
Which of the following files will need to be modified for this server to be able to boot again?
A. /etc/mtab
B. /dev/sda
C. /etc/fstab
D. /ete/grub.conf
Selected Answer: C
Question #: 118
Topic #: 1
A systems administrator frequently connects to a remote host via SSH and a non-standard port. The systems administrator would like to avoid passing the port parameter on the command line every time. Which of the following files can be used to set a different port value for that host?
A. /etc/ssh/sshd_config
B. /etc/ssh/moduli
C. ~/.ssh/config
D. ~/.ssh/authorized_keys
Selected Answer: A
Question #: 119
Topic #: 1
A Linux administrator modified the SSH configuration file. Which of the following commands should be used to apply the configuration changes?
A. systemctl stop sshd
B. systemctl mask sshd
C. systemctl reload sshd
D. systemctl start sshd
Selected Answer: C
Question #: 120
Topic #: 1
A cloud engineer needs to check the link status of a network interface named eth1 in a Linux server. Which of the following commands can help to achieve the goal?
A. ifconfig hw eth1
B. netstat -r eth1
C. ss -ti eth1
D. ip link show eth1
Selected Answer: D
Question #: 121
Topic #: 1
A systems administrator is tasked with setting up key-based SSH authentication. In which of the following locations should the administrator place the public keys for the server?
A. ~/.sshd/authkeys
B. ~/.ssh/keys
C. ~/.ssh/authorized_keys
D. ~/.ssh/keyauth
Selected Answer: C
Question #: 122
Topic #: 1
A Linux administrator needs to create a new user named user02. However, user02 must be in a different home directory, which is under /comptia/projects. Which of the following commands will accomplish this task?
A. useradd -d /comptia/projects user02
B. useradd -m /comptia/projects user02
C. useradd -b /comptia/projects user02
D. useradd -s /comptia/projects user02
Selected Answer: A
Question #: 123
Topic #: 1
One leg of an LVM-mirrored volume failed due to the underlying physical volume, and a systems administrator is troubleshooting the issue. The following output has been provided:
Given this scenario, which of the following should the administrator do to recover this volume?
A. Reboot the server. The volume will automatically go back to linear mode.
B. Replace the failed drive and reconfigure the mirror.
C. Reboot the server. The volume will revert to stripe mode.
D. Recreate the logical volume.
Selected Answer: B
Question #: 124
Topic #: 1
A systems administrator created a new Docker image called test. After building the image, the administrator forgot to version the release. Which of the following will allow the administrator to assign the v1 version to the image?
A. docker image save test test:v1
B. docker image build test:vl
C. docker image tag test test:vl
D. docker image version test:v1
Selected Answer: C
Question #: 125
Topic #: 1
A Linux systems administrator receives a notification that one of the server’s filesystems is full. Which of the following commands would help the administrator to identify this filesystem?
A. lsblk
B. fdisk
C. df -h
D. du -ah
Selected Answer: C
Question #: 126
Topic #: 1
A systems administrator is notified that the mysqld process stopped unexpectedly. The systems administrator issues the following command:
sudo grep –i -r ‘out of memory’ /var/log
The output of the command shows the following:
kernel: Out of memory: Kill process 9112 (mysqld) score 511 or sacrifice child.
Which of the following commands should the systems administrator execute NEXT to troubleshoot this issue? (Select two).
A. free -h
B. nc -v 127.0.0.1 3306
C. renice -15 $( pidof mysql )
D. lsblk
E. killall -15
F. vmstat -a 1 4
Selected Answer: AF
Question #: 127
Topic #: 1
Users have reported that the interactive sessions were lost on a Linux server. A Linux administrator verifies the server was switched to rescue.target mode for maintenance. Which of the following commands will restore the server to its usual target?
A. telinit 0
B. systemctl reboot
C. systemctl get-default
D. systemctl emergency
Selected Answer: B
Question #: 128
Topic #: 1
A systems administrator was tasked with assigning the temporary IP address/netmask 192.168.168.1/255.255.255.255 to the interface eth0 of a Linux server.
When adding the address, the following error appears:
# ip address add 192.168.168.1/33 dev eth0
Error: any valid prefix is expected rather than “192.168.168.1/33”.
Based on the command and its output above, which of the following is the cause of the issue?
A. The CIDR value /33 should be /32 instead.
B. There is no route to 192.168.168.1/33.
C. The interface eth0 does not exist.
D. The IP address 192.168.168.1 is already in use.
Selected Answer: A
Question #: 129
Topic #: 1
A Linux user reported the following error after trying to connect to the system remotely: ssh: connect to host 10.0.1.10 port 22: Resource temporarily unavailable
The Linux systems administrator executed the following commands in the Linux system while trying to diagnose this issue:
Which of the following commands will resolve this issue?
A. firewall-cmd –zone=public –permanent –add-service=22
B. systemctl enable firewalld; systemctl restart firewalld
C. firewall-cmd –zone=public –permanent –add-service=ssh
D. firewall-cmd –zone=public –permanent –add-port=22/udp
Selected Answer: C
Question #: 130
Topic #: 1
A Linux administrator has been tasked with installing the most recent versions of packages on a RPM-based OS. Which of the following commands will accomplish this task?
A. apt-get upgrade
B. rpm -a
C. yum updateinfo
D. dnf update
E. yum check-update
Selected Answer: D
Question #: 131
Topic #: 1
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
Selected Answer: D
Question #: 132
Topic #: 1
Which of the following directories is the mount point in a UEFI system?
A. /sys/efi
B. /boot/efi
C. /efi
D. /etc/efi
Selected Answer: B
Question #: 133
Topic #: 1
A Linux administrator copied a Git repository locally, created a feature branch, and committed some changes to the feature branch. Which of the following Git actions should the Linux administrator use to publish the changes to the main branch of the remote repository?
A. rebase
B. tag
C. commit
D. push
Selected Answer: D
Question #: 134
Topic #: 1
A Linux administrator needs to obtain a list of all volumes that are part of a volume group. Which of the following commands should the administrator use to accomplish this task?
A. vgs
B. lvs
C. fdisk -1
D. pvs
Selected Answer: B
Question #: 135
Topic #: 1
A Linux administrator is adding a new configuration file to a Git repository. Which of the following describes the correct order of Git commands to accomplish the task successfully?
A. pull -> push -> add -> checkout
B. pull -> add -> commit -> push
C. checkout -> push -> add -> pull
D. pull -> add -> push -> commit
Selected Answer: B
Question #: 136
Topic #: 1
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
Selected Answer: A
Question #: 137
Topic #: 1
User1 is a member of the accounting group. Members of this group need to be able to execute but not make changes to a script maintained by User2. The script should not be accessible to other users or groups. Which of the following will give proper access to the script?
A. chown user2:accounting script.sh
chmod 750 script.sh
B. chown user1:accounting script.sh
chmod 777 script.sh
C. chown accounting:user1 script.sh
chmod 057 script.sh
D. chown user2:accounting script.sh
chmod u+x script.sh
Selected Answer: A
Question #: 138
Topic #: 1
A systems administrator needs to verify whether the built container has the app.go file in its root directory. Which of the following can the administrator use to verify the root directory has this file?
A. docker image inspect
B. docker container inspect
C. docker exec
D. docker ps
Selected Answer: C
Question #: 139
Topic #: 1
A Linux administrator is reviewing changes to a configuration file that includes the following section:
The Linux administrator is trying to select the appropriate syntax formatter to correct any issues with the configuration file. Which of the following should the syntax formatter support to meet this goal?
A. Markdown
B. XML
C. YAMLD. JSON
Selected Answer: C
Question #: 140
Topic #: 1
A systems administrator is investigating an issue in which one of the servers is not booting up properly. The journalctl entries show the following:
Which of the following will allow the administrator to boot the Linux system to normal mode quickly?
A. Comment out the /opt/app filesystem in /etc/fstab and reboot.
B. Reformat the /opt/app filesystem and reboot.
C. Perform filesystem checks on local filesystems and reboot.
D. Trigger a filesystem relabel and reboot.
Selected Answer: A
Question #: 141
Topic #: 1
A Linux systems administrator receives reports from various users that an application hosted on a server has stopped responding at similar times for several days in a row. The administrator logs in to the system and obtains the following output:
Output 1:
Output 2:
Output 3:
Which of the following should the administrator do to provide the BEST solution for the reported issue?
A. Configure memory allocation policies during business hours and prevent the Java process from going into a zombie state while the server is idle.
B. Configure a different nice value for the Java process to allow for more users and prevent the Java process from restarting during business hours.
C. Configure more CPU cores to allow for the server to allocate more processing and prevent the Java process from consuming all of the available resources.
D. Configure the swap space to allow for spikes in usage during peak hours and prevent the Java process from stopping due to a lack of memory.
Selected Answer: D
Question #: 142
Topic #: 1
A Linux administrator found many containers in an exited state. Which of the following commands will allow the administrator to clean up the containers in an exited state?
A. docker rm –all
B. docker rm $(docker ps -aq)
C. docker images prune *
D. docker rm –state exited
Selected Answer: B
Question #: 143
Topic #: 1
A Linux administrator reviews a set of log output files and needs to identify files that contain any occurrence of the word denied. All log files containing entries in uppercase or lowercase letters should be included in the list. Which of the following commands should the administrator use to accomplish this task?
A. find . -type f -print | xrags grep -ln denied
B. find . -type f -print | xrags grep -nv denied
C. find . -type f -print | xrags grep -wL denied
D. find . -type f -print | xrags grep -li denied
Selected Answer: D
Question #: 144
Topic #: 1
A cloud engineer needs to launch a container named web-01 in background mode. Which of the following commands will accomplish this task?
A. docker builder -f –name web-01 httpd
B. docker load –name web-01 httpd
C. docker ps -a –name web-01 httpd
D. docker run -d –name web-01 httpd
Selected Answer: A
Question #: 145
Topic #: 1
A Linux administrator is providing a new Nginx image from the registry to local cache. Which of the following commands would allow this to happen?
A. docker pull nginx
B. docker attach nginx
C. docker commit nginx
D. docker import nginx
Selected Answer: B
Question #: 146
Topic #: 1
Which of the following tools is BEST suited to orchestrate a large number of containers across many different servers?
A. Kubernetes
B. Ansible
C. Podman
D. Terraform
Selected Answer: A
Question #: 147
Topic #: 1
A Linux administrator is installing a web server and needs to check whether web traffic has already been allowed through the firewall. Which of the following commands should the administrator use to accomplish this task?
A. firewalld query-service-http
B. firewall-cmd –check-service http
C. firewall-cmd –query-service http
D. firewalld –check-service http
Selected Answer: D
Question #: 148
Topic #: 1
A systems administrator is encountering performance issues. The administrator runs a command with the following output:
09:10:18 up 457 days, 32min, 5 users, load average: 4.22 6.63 5.58
The Linux server has the following system properties:
CPU 4 vCPU –
Memory: 50GB –
Which of the following accurately describes this situation?
A. The system is under CPU pressure and will require additional vCPUs.
B. The system has been running for over a year and requires a reboot.
C. Too many users are currently logged in to the system.
D. The system requires more memory.
Selected Answer: A
Question #: 149
Topic #: 1
A Linux administrator has set up a new DNS forwarder and is configuring all internal servers to use the new forwarder to look up external DNS requests. The administrator needs to modify the firewall on the server for the DNS forwarder to allow the internal servers to communicate to it and make the changes persistent between server reboots. Which of the following commands should be run on the DNS forwarder server to accomplish this task?
A. ufw allow out dns
B. systemctl reload firewalld
C. iptables -A OUTPUT -p udp -m udp -dport 53 -j ACCEPT
D. firewall-cmd –zone=public –add-port=53/udp –permanent
Selected Answer: D
Question #: 150
Topic #: 1
A Linux engineer receives reports that files created within a certain group are being modified by users who are not group members. The engineer wants to reconfigure the server so that only file owners and group members can modify new files by default. Which of the following commands would accomplish this task?
A. chmod 775
B. umask. 002
C. chattr -Rv
D. chown -cf
Selected Answer: B