Pre-Summer 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: 44 questions
Total 149 questions

CompTIA Linux+ V8 Exam Questions and Answers

Question 1

Which of the following commands should a Linux administrator use to determine the version of a kernel module?

Options:

A.

modprobe bluetooth

B.

lsmod bluetooth

C.

depmod bluetooth

D.

modinfo bluetooth

Question 2

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 3

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 4

A systems administrator wants to prevent the current contents of a file from being overwritten and wants to allow new additions at the end of the file. Which of the following commands should the administrator use?

Options:

A.

setenforce file

B.

setfacl -m m::t file

C.

chattr +a file

D.

chmod +t file

Question 5

A systems administrator is decommissioning a service. Which of the following commands should the administrator use to make sure users cannot start the service again?

Options:

A.

systemctl mask service

B.

systemctl kill service

C.

systemctl isolate service

D.

systemctl disable service

Question 6

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 7

(Partial question based on visible options)

Options:

A.

(not visible)

B.

(not visible)

C.

pam.conf

D.

smb.conf

Question 8

(Partial question reconstructed from visible content)

Options:

A.

(not visible)

B.

(not visible)

C.

pam.conf

D.

smb.conf

Question 9

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 10

Application owners are reporting that their application stops responding after several days of running, and they need to restart it. A Linux administrator obtains the following details from the dmesg command:

invoked oom-killer

Call Trace:

out_of_memory

oom_kill_process

The application owners mentioned that resources to the system have been increased, and the error takes longer to appear. Which of the following best describes the reason the process is being terminated by OOM?

Options:

A.

The CPU type is incompatible with the application.

B.

The kernel has panicked.

C.

The application might have a memory leak.

D.

The swap configuration is not correctly sized.

Question 11

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 12

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 13

An administrator must secure an account for a user who is going on extended leave. Which of the following steps should the administrator take? (Choose two)

Options:

A.

Set the user’s files to immutable.

B.

Instruct the user to log in once per week.

C.

Delete the user’s /home folder.

D.

Run the command passwd -l user.

E.

Change the date on the /home folder to that of the expected return date.

F.

Change the user’s shell to /sbin/nologin.

Question 14

A systems administrator is restoring data from a backup. While analyzing the file format, the administrator sees the following output:

data: 7-zip archive data, version 0.4

Which of the following commands should the administrator use to help extract the data?

Options:

A.

7za e data

B.

tar x --lzip --format=v7 data

C.

unzip -p 7 data

D.

zcat -S 7 data

Question 15

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 16

Which of the following describes PEP 8?

Options:

A.

The style guide for Python code

B.

Python virtual environments

C.

A package installer for Python

D.

A Python variable holding octal values

Question 17

A systems administrator is reconfiguring existing user accounts in a Linux system. Which of the following commands should the administrator use to include " myuser " in the finance group?

Options:

A.

groupadd finance myuser

B.

groupmod finance myuser

C.

useradd -g finance myuser

D.

usermod -aG finance myuser

Question 18

A systems administrator needs to integrate a new storage array into the company ' s existing storage pool. The administrator wants to ensure that the server is able to detect the new storage array. Which of the following commands should the administrator use to ensure that the new storage array is presented to the systems?

Options:

A.

lsscsi

B.

lsusb

C.

lsipc

D.

lshw

Question 19

Which of the following is the location for built-in Linux executable files and utilities?

Options:

A.

/bin

B.

/var

C.

/etc

D.

/sys

Question 20

A Linux systems administrator needs to extract the contents of a file named /home/dev/web.bkp to the /var/www/html/ directory. Which of the following commands should the administrator use?

Options:

A.

cd /var/www/html/ & & gzip -c /home/dev/web.bkp | tar xf -

B.

pushd /var/www/html/ & & cpio -idv < /home/dev/web.bkp & & popd

C.

tar -c -f /home/dev/web.bkp /var/www/html/

D.

unzip -c /home/dev/web.bkp /var/www/html/

Question 21

A Linux administrator receives reports that an application hosted in a system is not completing tasks in the allocated time. The administrator connects to the system and obtains the following details:

Which of the following actions can the administrator take to help speed up the jobs?

Options:

A.

Increase the amount of free memory available to the system.

B.

Increase the amount of CPU resources available to the system.

C.

Increase the amount of swap space available to the system.

D.

Increase the amount of disks available to the system.

Question 22

User1 reports " access denied " errors while trying to execute app. Given the following outputs:

Which of the following options will remediate this issue?

Options:

A.

Providing execute permissions to user1 in the ACL

B.

Modifying the permissions for others to grant read, write, and execute

C.

Adding user1 to the wheel group

D.

Moving app to a different folder

Question 23

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 24

Which of the following does dmesg display?

Options:

A.

Incorrect login attempts

B.

" Session closed " messages

C.

Window manager warnings

D.

USB device connections

Question 25

A systems administrator is creating a backup copy of the /home/ directory. Which of the following commands allows the administrator to archive and compress the directory at the same time?

Options:

A.

cpio -o /backups/home.tar.xz /home/

B.

rsync -z /backups/home.tar.xz /home/

C.

tar -cJf /backups/home.tar.xz /home/

D.

dd of=/backups/home.tar.xz if=/home/

Question 26

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 27

An administrator wants to search a file named myFile and look for all occurrences of strings containing at least five characters, where characters two and five are i, but character three is not b. Which of the following commands should the administrator execute to get the intended result?

Options:

A.

grep .a*^b-.a myFile

B.

grep .a., [a] myFile

C.

grepa^b*a myFile

D.

grep .i[^b].i myFile

Question 28

A Linux administrator is configuring a CUPS print service on a Linux machine and needs to allow only connections from a local network (192.168.100.0/24). Which of the following commands should the administrator use?

Options:

A.

iptables -A OUTPUT -d 192.168.100.0/24 --sport 631 -p tcp -j ACCEPT

B.

iptables -A OUTPUT -s 192.168.100.0/24 --dport 631 -p tcp -j ACCEPT

C.

iptables -A INPUT -s 192.168.100.0/24 --dport 631 -p tcp -j ACCEPT

D.

iptables -D INPUT -d 192.168.100.0/24 --dport 631 -p tcp -j ACCEPT

Question 29

A Linux user needs to authenticate to a Windows Active Directory domain. Which of the following configuration files contains the domain configuration details?

Options:

A.

sssd.conf

B.

krb5.conf

C.

pam.conf

D.

smb.conf

Question 30

A systems administrator is restoring data from a backup. While analyzing the file format, the administrator sees the following output:

data: 7-zip archive data, version 0.4

Which of the following commands should the administrator use to help extract the data?

Options:

A.

7za e data

B.

tar x --lzip --format=v7 data

C.

unzip -np 7 data

D.

zcat -S 7 data

Question 31

A systems administrator needs to check access to all company servers. The administrator uses the following script, which does not complete:

for i in $(cat /home/user1.file)

do

echo $i

ssh $i uptime

Which of the following is missing from the script?

Options:

A.

fi

B.

else

C.

while

D.

done

Question 32

A user reports recurrent issues with an application, which is currently operational. The systems administrator gathers the following outputs to diagnose the issue:

Out of memory: Kill process (mariadb)

Killed process (mariadb)

mariadb invoked oom-killer

egrep ' Out of memory ' /var/log/messages

Multiple entries showing mariadb being killed by OOM killer

free -m

Mem: total 15819, used 10026, free 5174, available 5134

Swap: 0 0 0

sar -r

kbmemused ~67%, no swap usage

Which of the following is a possible cause of this issue?

Options:

A.

A backup is consuming all the system memory.

B.

The system is using all the swap.

C.

The cached memory is approaching the system ' s limits.

D.

The process is showing signs of a memory leak.

Question 33

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 34

Which of the following is a protocol for accessing distributed directory services containing a hierarchy of users, groups, machines, and organizational units?

Options:

A.

SMB

B.

TLS

C.

LDAP

D.

KRB-5

Question 35

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 36

A Linux administrator wants to use AI to deploy infrastructure as code. Which of the following is a best practice regarding the use of AI for this task?

Options:

A.

Using copy and paste when possible

B.

Generating monolithic code

C.

Linting generated code

D.

Merging CI/CD pipelines

Question 37

Which of the following passwords is the most complex?

Options:

A.

H3sa1dt01d

B.

he$@ID$heTold

C.

H3s@1dSh3t0|d

D.

HeSaidShetold

Question 38

A systems administrator is preparing a Linux system for application setup. The administrator needs to create an environment variable with a persistent value in one of the user accounts. Which of the following commands should the administrator use for this task?

Options:

A.

export " VAR=SomeValue " > > ~/.ssh/profile

B.

export VAR=value

C.

VAR=value

D.

echo " export VAR=value " > > ~/.bashrc

Question 39

A Linux administrator receives reports that an application hosted in a system is not completing tasks in the allocated time. The administrator connects to the system and obtains the following details:

$ uptime

12:47:43 up 22:17, 2 users, load average: 7.75, 5.72, 5.17

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

Options:

A.

High CPU load

B.

Insufficient disk space

C.

Network latency

D.

Memory leak

Question 40

An administrator wants to see all logs for the app.service systemd process. Which of the following commands should the administrator use to complete this task?

Options:

A.

cat /var/log/messages

B.

systemctl status app.service

C.

systemd-analyze unit-files app.service

D.

journalctl -u app.service

Question 41

A Linux system displays the following error during operation:

Kernel panic - not syncing: Fatal Machine check

Pid: 0, comm: swapper Tainted: G M

Call Trace:

...

mce_panic

do_machine_check

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

Options:

A.

Filesystem corruption

B.

Hardware failure (CPU or memory)

C.

Misconfigured bootloader

D.

Incorrect file permissions

Question 42

A Linux administrator needs to analyze a compromised disk for traces of malware. To complete the analysis, the administrator wants to make an exact, block-level copy of the disk. Which of the following commands accomplishes this task?

Options:

A.

cp -rp /dev/sdc/* /tmp/image

B.

cpio -i /dev/sdc -ov /tmp/image

C.

tar cvzf /tmp/image /dev/sdc

D.

dd if=/dev/sdc of=/tmp/image bs=8192

Question 43

An administrator is trying to terminate a process that is not responding. Which of the following commands should the administrator use in order to force the termination of the process?

Options:

A.

kill PID

B.

kill -1 PID

C.

kill -9 PID

D.

kill -15 PID

Question 44

Which of the following Ansible components is used to define groups and individual hosts and can include variables specific to each host or group?

Options:

A.

Modules

B.

Inventory

C.

Playbooks

D.

Handlers

Demo: 44 questions
Total 149 questions