XK0-005: CompTIA Linux+ Topic 1
Question #: 1
Topic #: 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?
A. rpm -qa | grep kernel; uname -a
B. yum -y update; shutdown -r now
C. cat /etc/centos-release; rpm -Uvh –nodeps
D. telinit 1; restorecon -Rv /boot
Selected Answer: D
Question #: 2
Topic #: 1
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
Selected Answer: C
Question #: 3
Topic #: 1
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?
A. git reflog
B. git pull
C. git status
D. git push
Selected Answer: B
Question #: 4
Topic #: 1
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?
A. iptables -t nat -D PREROUTING -p tcp –sport 80 -j DNAT – -to-destination 192.0.2.25:3128
B. iptables -t nat -A PREROUTING -p top –dport 81 -j DNAT –-to-destination 192.0.2.25:3129
C. iptables -t nat -I PREROUTING -p top –sport 80 -j DNAT –-to-destination 192.0.2.25:3129
D. iptables -t nat -A PREROUTING -p tcp –dport 80 -j DNAT –-to-destination 192.0.2.25:3128
Selected Answer: D
Question #: 5
Topic #: 1
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?
A. route -i etho -p add 10.0.213.5 10.0.5.1
B. route modify eth0 +ipv4.routes “10.0.213.5/32 10.0.5.1”
C. echo “10.0.213.5 10.0.5.1 eth0” > /proc/net/route
D. ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
Selected Answer: D
Question #: 6
Topic #: 1
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
A. if [ -f “$filename” ]; then
B. if [ -d “$filename” ]; then
C. if [ -f “$filename” ] then
D. if [ -f “$filename” ]; while
Selected Answer: C
Question #: 8
Topic #: 1
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?
A. Ansible
B. Puppet
C. Chef
D. Terraform
Selected Answer: D
Question #: 9
Topic #: 1
Which of the following technologies can be used as a central repository of Linux users and groups?
A. LDAP
B. MFA
C. SSO
D. PAM
Selected Answer: A
Question #: 10
Topic #: 1
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?
A. The address ac:00:11:22:33:cd is not a valid Ethernet address.
B. The Ethernet broadcast address should be ac:00:11:22:33:ff instead.
C. The network interface eth0 is using an old kernel module.
D. The network interface cable is not connected to a switch.
Selected Answer: D
Question #: 11
Topic #: 1
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 run -d -p 443:8443 httpd
B. podman run -d -p 8443:443 httpd
C. podman run –d -e 443:8443 httpd
D. podman exec -p 8443:443 httpd
Selected Answer: B
Question #: 12
Topic #: 1
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?
A. docker run -ti app /bin/sh
B. podman exec -ti app /bin/sh
C. podman run -d app /bin/bash
D. docker exec -d app /bin/bash
Selected Answer: B
Question #: 13
Topic #: 1
A systems administrator needs to clone the partition /dev/sdc1 to /dev/sdd1. Which of the following commands will accomplish this task?
A. tar -cvzf /dev/sdd1 /dev/sdc1
B. rsync /dev/sdc1 /dev/sdd1
C. dd if=/dev/sdc1 of=/dev/sdd1
D. scp /dev/sdc1 /dev/sdd1
Selected Answer: C
Question #: 14
Topic #: 1
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?
A. The wrong permissions are on the user’s home directory.
B. The account was locked out due to three failed logins.
C. The user entered the wrong password.
D. The user has the wrong shell assigned to the account.
Selected Answer: D
Question #: 15
Topic #: 1
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.)
A. wget
B. ssh-keygen
C. ssh-keyscan
D. ssh-copy-id
E. ftpd
F. scp
Selected Answer: D
Question #: 16
Topic #: 1
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?
A. echo 1 > /proc/sys/net/ipv4/ipv_forward
B. sysctl -w net.ipv4.ip_forward=1
C. firewall-cmd –enable ipv4_forwarding
D. systemctl start ipv4_forwarding
Selected Answer: A
Question #: 17
Topic #: 1
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?
A. The checkdiskspace.service is not running.
B. The checkdiskspace.service needs to be enabled.
C. The OnCalendar schedule is incorrect in the timer definition.
D. The system-daemon services need to be reloaded.
Selected Answer: C
Question #: 18
Topic #: 1
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?
A. semanage port -d -t http_port_t -p tcp 6379
B. semanage port -a -t http_port_t -p tcp 6379
C. semanage port -a http_port_t -p top 6379
D. semanage port -l -t http_port_tcp 6379
Selected Answer: B
Question #: 19
Topic #: 1
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?
A. hostnamectl status –no-ask-password
B. hostnamectl set-hostname “$(perl -le “print” “A” x 86)”
C. hostnamectl set-hostname Comptia-WebNode -H root@192.168.2.14
D. hostnamectl set-hostname Comptia-WebNode –transient
Selected Answer: C
Question #: 20
Topic #: 1
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?
A. scp -p /data remote:/backup/data
B. ssh -i /remote:/backup/ /data
C. rsync -a /data remote:/backup/
D. cp -r /data /remote/backup/
Selected Answer: D
Question #: 21
Topic #: 1
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
Selected Answer: D
Question #: 22
Topic #: 1
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. chgrp reet files
B. chacl -R 644 files
C. chown users files
D. chmod -t files
Selected Answer: D
Question #: 23
Topic #: 1
Which of the following commands will display the operating system?
A. uname -n
B. uname -s
C. uname -o
D. uname -m
Selected Answer: C
Question #: 24
Topic #: 1
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.
Selected Answer: D
Question #: 25
Topic #: 1
A Linux administrator recently downloaded a software package that is currently in a compressed file. Which of the following commands will extract the files?
A. unzip -v
B. bzip2 -z
C. gzip
D. funzip
Selected Answer: D
Question #: 26
Topic #: 1
A Linux administrator is troubleshooting SSH connection issues from one of the workstations.
When users attempt to log in from the workstation to a server with the IP address 104.21.75.76, they receive the following message:
The administrator reviews the information below:
Which of the following is causing the connectivity issue?
A. The workstation has the wrong IP settings.
B. The sshd service is disabled.
C. The server’s firewall is preventing connections from being made.
D. The server has an incorrect default gateway configuration.
Selected Answer: C
Question #: 27
Topic #: 1
Which of the following files holds the system configuration for journal when running systemd?
A. /etc/systemd/journald.conf
B. /etc/systemd/systemd-journalctl.conf
C. /usr/lib/systemd/journalctl.conf
D. /etc/systemd/systemd-journald.conf
Selected Answer: A
Question #: 28
Topic #: 1
A Linux administrator is tasked with creating resources using containerization. When deciding how to create this type of deployment, the administrator identifies some key features, including portability, high availability, and scalability in production. Which of the following should the Linux administrator choose for the new design?
A. Docker
B. On-premises systems
C. Cloud-based systems
D. Kubernetes
Selected Answer: D
Question #: 29
Topic #: 1
Which of the following tools is commonly used for creating CI/CD pipelines?
A. Chef
B. Puppet
C. Jenkins
D. Ansible
Selected Answer: C
Question #: 30
Topic #: 1
A systems administrator requires that all files that are created by the user named web have read-only permissions by the owner. Which of the following commands will satisfy this requirement?
A. chown web:web /home/web
B. chmod -R 400 /home/web
C. echo “umask 377” >> /home/web/.bashrc
D. setfacl read /home/web
Selected Answer: C
Question #: 31
Topic #: 1
A systems administrator is tasked with preventing logins from accounts other than root, while the file /etc/nologin exists. Which of the following PAM modules will accomplish this task?
A. pam_login.so
B. pam_access.so
C. pam_logindef.so
D. pam_nologin.so
Selected Answer: C
Question #: 32
Topic #: 1
A systems administrator has been tasked with disabling the nginx service from the environment to prevent it from being automatically and manually started. Which of the following commands will accomplish this task?
A. systemctl cancel nginx
B. systemctl disable nginx
C. systemctl mask nginx
D. systemctl stop nginx
Selected Answer: C
Question #: 33
Topic #: 1
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 OnCalendar configuration to schedule the start of the logsearch.service.
D. Update the KillSignal configuration for the logsearch.service to use TERM.
Selected Answer: A
Question #: 34
Topic #: 1
A Linux administrator has installed a web server, a database server, and a web application on a server. The web application should be active in order to render the web pages. After the administrator restarts the server, the website displays the following message in the browser: Error establishing a database connection. The Linux administrator reviews the following relevant output from the systemd init files:
The administrator needs to ensure that the database is available before the web application is started. Which of the following should the administrator add to the HTTP server .service file to accomplish this task?
A. TRIGGERS=mariadb.service
B. ONFAILURE=mariadb.service
C. WANTEDBY=mariadb.service
D. REQUIRES=mariadb.service
Selected Answer: D
Question #: 35
Topic #: 1
Several users reported that they were unable to write data to the /oracle1 directory. The following output has been provided:
Which of the following commands should the administrator use to diagnose the issue?
A. df -i /oracle1
B. fdisk -1 /dev/sdb1
C. lsblk /dev/sdb1
D. du -sh /oracle1
Selected Answer: A
Question #: 36
Topic #: 1
After installing some RPM packages, a systems administrator discovers the last package that was installed was not needed. Which of the following commands can be used to remove the package?
A. dnf remove packagename
B. apt-get remove packagename
C. rpm -i packagename
D. apt remove packagename
Selected Answer: A
Question #: 37
Topic #: 1
A systems administrator is checking the system logs. The administrator wants to look at the last 20 lines of a log. Which of the following will execute the command?
A. tail -v 20
B. tail -n 20
C. tail -c 20
D. tail -l 20
Selected Answer: B
Question #: 38
Topic #: 1
An administrator is trying to diagnose a performance issue and is reviewing the following output:
System Properties:
CPU: 4 vCPU –
Memory: 40GB –
Disk maximum IOPS: 690 –
Disk maximum throughput: 44Mbps | 44000Kbps
Based on the above output, which of the following BEST describes the root cause?
A. The system has reached its maximum IOPS, causing the system to be slow.
B. The system has reached its maximum permitted throughput, therefore iowait is increasing.
C. The system is mostly idle, therefore the iowait is high.
D. The system has a partitioned disk, which causes the IOPS to be doubled.
Selected Answer: B
Question #: 39
Topic #: 1
A systems administrator wants to test the route between IP address 10.0.2.15 and IP address 192.168.1.40. Which of the following commands will accomplish this task?
A. route -e get to 192.168.1.40 from 10.0.2.15
B. ip route get 192.163.1.40 from 10.0.2.15
C. ip route 192.169.1.40 to 10.0.2.15
D. route -n 192.168.1.40 from 10.0.2.15
Selected Answer: B
Question #: 40
Topic #: 1
A Linux administrator was tasked with deleting all files and directories with names that are contained in the sobelete.txt file. Which of the following commands will accomplish this task?
A. xargs -f cat toDelete.txt -rm
B. rm -d -r -f toDelete.txt
C. cat toDelete.txt | rm -frd
D. cat toDelete.txt | xargs rm -rf
Selected Answer: D
Question #: 41
Topic #: 1
A Linux administrator is troubleshooting the root cause of a high CPU load and average.
Which of the following commands will permanently resolve the issue?
A. renice -n -20 6295
B. pstree -p 6295
C. iostat -cy 1 5
D. kill -9 6295
Selected Answer: D
Question #: 42
Topic #: 1
A Linux administrator wants to set the SUID of a file named dev_team.text with 744 access rights. Which of the following commands will achieve this goal?
A. chmod 4744 dev_team.txt
B. chmod 744 –setuid dev_team.txt
C. chmod -c 744 dev_team.txt
D. chmod -v 4744 –suid dev_team.txt
Selected Answer: B
Question #: 43
Topic #: 1
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/
Selected Answer: C
Question #: 44
Topic #: 1
A Linux administrator needs to ensure that Java 7 and Java 8 are both locally available for developers to use when deploying containers. Currently only Java 8 is available. Which of the following commands should the administrator run to ensure both versions are available?
A. docker image load java:7
B. docker image pull java:7
C. docker image import java:7
D. docker image build java:7
Selected Answer: B
Question #: 45
Topic #: 1
A cloud engineer is installing packages during VM provisioning. Which of the following should the engineer use to accomplish this task?
A. Cloud-init
B. Bash
C. Docker
D. Sidecar
Selected Answer: D
Question #: 46
Topic #: 1
A systems administrator is tasked with creating a cloud-based server with a public IP address.
The code is as follows:
Which of the following technologies did the systems administrator use to complete this task?
A. Puppet
B. Git
C. Ansible
D. Terraform
Selected Answer: C
Question #: 47
Topic #: 1
A Linux systems administrator is setting up a new web server and getting 404 – NOT FOUND errors while trying to access the web server pages from the browser. While working on the diagnosis of this issue, the Linux systems administrator executes the following commands:
Which of the following commands will BEST resolve this issue?
A. sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config
B. restorecon -R -v /var/www/html
C. setenforce 0
D. setsebool -P httpd_can_network_connect_db on
Selected Answer: B
Question #: 48
Topic #: 1
To harden one of the servers, an administrator needs to remove the possibility of remote administrative login via the SSH service. Which of the following should the administrator do?
A. Add the line DenyUsers root to the /etc/hosts.deny file.
B. Set PermitRootLogin to no in the /etc/ssh/sshd_config file.
C. Add the line account required pam_nologin. so to the /etc/pam.d/sshd file.
D. Set PubKeyAuthentication to no in the /etc/ssh/ssh_config file.
Selected Answer: B
Question #: 49
Topic #: 1
Which of the following is a function of a bootloader?
A. It initializes all the devices that are required to load the OS.
B. It mounts the root filesystem that is required to load the OS.
C. It helps to load the different kernels to initiate the OS startup process.
D. It triggers the start of all the system services.
Selected Answer: C
Question #: 50
Topic #: 1
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. iptables is conflicting with firewalld.
B. The wrong system target is activated.
C. FIREWALL_ARGS has no value assigned.
D. The firewalld service is not enabled.
Selected Answer: D