Spring Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70percent

CompTIA XK0-006 CompTIA Linux+ V8 Exam Exam Practice Test

Demo: 25 questions
Total 87 questions

CompTIA Linux+ V8 Exam Questions and Answers

Question 1

Which of the following commands should an administrator use to see a full hardware inventory of a Linux system?

Options:

A.

dmidecode

B.

lsmod

C.

dmesg

D.

lscpu

Question 2

A Linux user frequently tests shell scripts located in the /home/user/scripts directory. Which of the following commands allows the user to run the program by invoking only the script name?

Options:

A.

export SHELL=$SHELL=/home/user/scripts

B.

export TERM=$TERM=/home/user/scripts

C.

export PATH=$PATH:/home/user/scripts

D.

export alias /home/user/scripts='/bin'

Question 3

A Linux software developer wants to use AI to optimize source code used in a commercial product. Which of the following steps should the developer take first?

Options:

A.

Research which available AI chatbots are best at optimizing source code.

B.

Verify that the company has a policy governing the use of AI in software development.

C.

Install a private LLM to use on the internal network for source code optimization.

D.

Use open-source LLMs that undergo regular security reviews by the community.

Question 4

A systems administrator wants to review the logs from an Apache 2 error.log file in real time and save the information to another file for later review. Which of the following commands should the administrator use?

Options:

A.

tail -f /var/log/apache2/error.log > logfile.txt

B.

tail -f /var/log/apache2/error.log | logfile.txt

C.

tail -f /var/log/apache2/error.log >> logfile.txt

D.

tail -f /var/log/apache2/error.log | tee logfile.txt

Question 5

An administrator added a new disk to expand the current storage. Which of the following commands should the administrator run first to add the new disk to the LVM?

Options:

A.

vgextend

B.

lvextend

C.

pvcreate

D.

pvresize

Question 6

Users cannot access a server after it has been restarted. At the server console, the administrator runs the following commands;

Which of the following is the cause of the issue?

Options:

A.

The DNS entry does not have a valid IP address.

B.

The SSH service has not been allowed on the firewall.

C.

The server load average is too high.

D.

The wrong protocol is being used to connect to the web server.

Question 7

In the echo "profile-$num-$name" line of a shell script, the variable $num seems to not be expanding during execution. Which of the following notations ensures the value is expanded?

Options:

A.

echo "profile-$(num)-$name"

B.

echo 'profile-$num-$name'

C.

echo "profile-'$num'-$name"

D.

echo "profile-${num}-$name"

Question 8

Which of the following best describes a use case for playbooks in a Linux system?

Options:

A.

To provide a set of tasks and configurations to deploy an application

B.

To provide the instructions for implementing version control on a repository

C.

To provide the security information required for a container

D.

To provide the storage volume information required for a pod

Question 9

Which of the following is a reason multiple password changes on the same day are not allowed?

Options:

A.

To avoid brute-forced password attacks by making them too long to perform

B.

To increase password complexity and the system's security

C.

To stop users from circulating through the password history to return to the originally used password

D.

To enforce using multifactor authentication with stronger encryption algorithms instead of passwords

Question 10

An administrator is investigating the reason a Linux workstation is not resolving the website http://www.comptia.org. The administrator executes some commands and receives the following output:

Which of the following is the most likely cause?

Options:

A.

The static entry needs to be removed from /etc/hosts.

B.

The remote website does not support IPv6, and the workstation requires it.

C.

The firewall needs to be modified to allow outbound HTTP and HTTPS.

D.

The nameserver in /etc/resolv.conf needs to be updated to 8.8.8.8

Question 11

An administrator needs to verify the user ID, home directory, and assigned shell for the user named "accounting." Which of the following commands should the administrator use to retrieve this information?

Options:

A.

getent passwd accounting

B.

id accounting

C.

grep accounting /etc/shadow

D.

who accounting

Question 12

A systems administrator manages multiple Linux servers and needs to set up a reliable and secure way to handle the complexity of managing event records on the OS and application levels. Which of the following should the administrator do?

Options:

A.

Create an automated process to retrieve logs from the server by demand.

B.

Implement a centralized log aggregation solution.

C.

Configure daily automatic backups of logs to remote storage.

D.

Deploy log rotation procedures to manage the records.

Question 13

A Linux systems administrator is running an important maintenance task that consumes a large amount of CPU, causing other applications to slow. Which of the following actions should the administrator take to help alleviate the issue?

Options:

A.

Increase the available CPU time with pidstat.

B.

Lower the priority of the maintenance task with renice.

C.

Run the maintenance task with nohup.

D.

Execute the other applications with the bg utility.

Question 14

Which of the following can reduce the attack surface area in relation to Linux hardening?

Options:

A.

Customizing the log-in banner

B.

Reducing the number of directories created

C.

Extending the SSH startup timeout period

D.

Enforcing password strength and complexity

Question 15

A systems administrator wants to review the amount of time the NetworkManager service took to start. Which of the following commands accomplishes this goal?

Options:

A.

resolvectl

B.

journalctl

C.

systemctl daemon-reload

D.

systemd-analyze blame

Question 16

A Linux administrator just finished setting up passwordless SSH authentication between two nodes. However, upon test validation, the remote host prompts for a password. Given the following logs:

Which of the following is the most likely cause of the issue?

Options:

A.

The SELinux policy is incorrectly targeting the unconf ined_u context.

B.

The administrator forgot to restart the SSHD after creating the authorizedjceys file.

C.

The authorized_keys file has the incorrect root permissions assigned.

D.

The authorized_keys file does not have the correct security context to match SELinux policy.

Question 17

A systems administrator needs to enable routing of IP packets between network interfaces. Which of the following kernel parameters should the administrator change?

Options:

A.

net.ipv4.ip_multicast

B.

net.ipv4.ip_route

C.

net.ipv4.ip_local_port_range

D.

net.ipv4.ip_forward

Question 18

A Linux administrator needs to securely erase the contents of a hard disk. Which of the following commands is the best for this task?

Options:

A.

sudo rm -rf /dev/sda1

B.

sudo shred /dev/sda1

C.

sudo parted rm /dev/sda1

D.

sudo dd if=/dev/null of=/dev/sda1

Question 19

An administrator needs to remove the directory /home/user1/data and all of its contents. Which of the following commands should the administrator use?

Options:

A.

rmdir -p /home/user1/data

B.

ln -d /home/user1/data

C.

rm -r /home/user1/data

D.

cut -d /home/user1/data

Question 20

A Linux administrator tries to install Ansible in a Linux environment. One of the steps is to change the owner and the group of the directory /opt/Ansible and its contents. Which of the following commands will accomplish this task?

Options:

A.

groupmod -g Ansible -n /opt/Ansible

B.

chown -R Ansible:Ansible /opt/Ansible

C.

usermod -aG Ansible /opt/Ansible

D.

chmod -c /opt/Ansible

Question 21

Which of the following commands should an administrator use to convert a KVM disk file to a different format?

Options:

A.

qemu-kvm

B.

qemu-ng

C.

qemu-io

D.

qemu-img

Question 22

A Linux administrator updates the DNS record for the company using:

cat /etc/bind/db.abc.com

The revised partial zone file is as follows:

ns1 IN A 192.168.40.251

ns2 IN A 192.168.40.252

www IN A 192.168.30.30

When the administrator attempts to resolve www.abc.com to its IP address, the domain name still points to its old IP mapping:

nslookup www.abc.com

Server: 192.168.40.251

Address: 192.168.40.251#53

Non-authoritative answer:

Name: www.abc.com

Address: 199.168.20.81

Which of the following should the administrator execute to retrieve the updated IP mapping?

Options:

A.

systemd-resolve query www.abc.com

B.

systemd-resolve status

C.

service nslcd reload

D.

resolvectl flush-caches

Question 23

A DevOps engineer needs to create a local Git repository. Which of the following commands should the engineer use?

Options:

A.

git init

B.

git clone

C.

git config

D.

git add

Question 24

Which of the following cryptographic functions ensures a hard drive is encrypted when not in use?

Options:

A.

GPG

B.

LUKS

C.

PKI certificates

D.

OpenSSL

Question 25

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?

Options:

A.

less

B.

tail -f

C.

tr -c

D.

wc -l

Demo: 25 questions
Total 87 questions