Summer Sale 60% Special Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: best60

CompTIA XK0-004 CompTIA Linux+ Certification Exam Exam Practice Test

Page: 1 / 48
Total 483 questions

CompTIA Linux+ Certification Exam Questions and Answers

Testing Engine

  • Product Type: Testing Engine
$48  $119.99

PDF Study Guide

  • Product Type: PDF Study Guide
$42  $104.99
Question 1

An administrator wants to add a user named comptia to the system administrators group. Which of the following commands will accomplish this task?

Options:

A.

Usermod –sG wheel comptia

B.

Useradd -sG wheel comptia

C.

visudo -sG wheel comptia

D.

sudo -sG wheel comptia

Question 2

A system administrator needs to run a job called payments_Reconciliation on the last day of the month at the end of the day. Which of the following lines in crontab should be inserted to complete job?

A)

B)

C)

D)

Options:

A.

Option

B.

Option

C.

Option

D.

Option

Question 3

A security team informs the Linux administrator that a specific sever is acting as a n pen relay. To which of the following is the security team referring?

Options:

A.

The server it running the SSH service and is open to the internet allowing outside sources to log in to the server without source IP address filtering.

B.

The server is acting as an unmanaged router, open to the internal and is allowing outside internet traffic into the network with on filtering.

C.

The server is acting as a web proxy and allowing outside unauthenticated sources to connect to the server, effectively hiding tie source's IP address for malicious activities.

D.

The server has an email service configured to allow outside sources to send email to other external parties on the internet without validation.

Question 4

Which of the following files would a junior systems administrator check to verify DNS server settings?

Options:

A.

/etc/network

B.

/etc/rsolveconf

C.

/etc/nsswitch,conf

D.

/etc/hosts

Question 5

An administrator wants to use a Linux server’s GUI remotely but is limited by security to using TCP port 22. Which of the following is the BEST choice for installation on the Linux server to enable this functionality?

Options:

A.

X-forwarding

B.

NX

C.

VNC

D.

XRDP

Question 6

The dracut command is used to:

Options:

A.

create initial RAMDisk images for preloading modules.

B.

compile the Linux kernel images used to boot the OS.

C.

create the bootloader executable files.

D.

create the Boot Manager configuration files.

Question 7

A systems administrator needs to install software packages on a server from an Internet-based repository. The server does not have Internet connectivity.

Which of the following can be used to allow the server to connect to the Internet through the systems administrator’s desktop?

Options:

A.

Local package repository

B.

UUCP

C.

Remote SSH port forwarding

D.

X11 forwarding

Question 8

Users are receiving permission-denied messages when trying to access a spreadsheet file within the company’s filesystem. A Linux administrator receives a ticket and begin to investigate the following output:

Which of the following command would produce the presented output?

Options:

A.

Top

B.

nice

C.

grep

D.

isof

Question 9

An administrator is utilizing an automation engine that engine that uses SSH to run command on remote systems. Which of the following does this describe?

Options:

A.

Inventory

B.

Agentless architecture

C.

Build automation

D.

Version control

Question 10

A system administrator recently installed and configure a web proxy server with the IP address 192.68 address. What is the should be implemented on then proxy server to ensure traffic is processes.

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 11

An administrator recently installed a second NIC in a server to interact with machines in an isolated enclave. However, the mnetworking on the server has not worked since it was installed. The administrator reviews the following output:

Which of the following should be the FIRST action to remediate the issue?

Options:

A.

Add a new route for each device in the isolated endave

B.

Set the ipv4.never-default attribute to yes for the new interface, enp0s4

C.

Change DEFROUTE to no for the new interface and restart the networking

D.

Restart the firewall to ensure traffic is handed appropriately

Question 12

Which of the following is the MOST common method used to access Windows systems that are running in a cloud provider from a Linux system?

Options:

A.

SSH

B.

NX

C.

XRDP

D.

VNC

Question 13

A systems administrator copied the latest archive Of the corporate application, corpapp.tar.gz, to a new server. The backup software lists the following entry in the log file:

Which of the following should the administrator run to verify the archive copied correctly without corruption?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 14

Which of the following commands will result in the HIGHEST compression level when using gzig to compress a file name file, txt?

Options:

A.

Gzip -9 file. text

B.

Gzip -100-file. Text

Crip –high file.txt

C.

Gzip -5 file.txt

D.

Gzip –fast file. text

Question 15

An administrator is provisioning and attaching a secondary disk to a Linux server as a data drive. Which Of the following commands the administrator use to find the UUID Of the disk so the drive can be mounted upon boot?

Options:

A.

blkid

B.

isblk

C.

2label

D.

fstab

Question 16

A systems administrator wants to increase the existing drive space on a Linux server with a software RAID. After physically adding the new drive to the system, and then adding the drive to the RAID array,

the administrator notices the available drive space has not increased. A status of the array shows the new drive and the original storage space:

md0 : active Raid sdd1[3]S sdc1[2] sdb1[1] sda1[0]

954585654 blocks level5 64K chunk algorithm 2 [3/3] [UUU]

Which of the following should the administrator do to make all storage space available on the RAID array?

Options:

A.

Run hdparm to alert the kernel to a new drive.

B.

Convert the new drive to a hot spare.

C.

Set the RAID type to a RAID 1.

D.

Grow the array size to four members.

Question 17

A technician reviews the following output:

Which of the following commands should the technical execute to ensure the system has the appropriate paging? (Select TWO.)

Options:

A.

dd if=dev/sda5 of=/tmp bs=512

B.

swapon /dev/sda5

C.

Mkswap/dev/sda5

D.

Mkfs,ext3 /dev/sda5

E.

Lostat/dev/sda 5

F.

Free –m/dev/sda

Question 18

A Linux administrator needs to run a command in the background of a terminal, Which of the following commands will BEST accomplish this task?

Options:

A.

./run_application $$ bg

B.

./run_application +$

C.

./run_application

D.

./run_application $

Question 19

A systems administrator needs to prevent the root account from being used to log in to a Linux server via SSH. Which of the following configuration ies does the systems administrator need to edit to perform this task?

Options:

A.

/etc/passwd

B.

/etc/sshd/config

C.

-/.ssh/config

D.

/etc/ayaconfig/sshd

Question 20

A systems administrator is installing an HTTPD server on a Linux server and configuring it as a proxy server. The administrator runs the following commands to verify that the service is running:

However, the administrator is getting a 503 error when browsing to portal . company. internal. After reviewing the logs, the following error information is discovered:

Which Of the following commands BEST resolves the issue?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 21

An administrator is writing a Bash script to audit SSH logins. Which of the following logs would the administrator parse to find the needed information?

Options:

A.

/var/log/secure/

B.

/var/log/messages

C.

/var/log/firewalld

D.

/var/log/sssd

Question 22

A Linux administrator is tasked with implementing a solution that will centralize information and allow it to be searchable and available for reporting purposes. Which of the following server roles should the administrator implement?

Options:

A.

SSH

B.

DNS

C.

Logging

D.

Proxy

E.

NTP

Question 23

A Linux administrator is optimizing a system in which an application needs to change the priority to one for the running process: 9014. Which of the following commands will achieve this task?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 24

Which of the following would be used to check a sensor input to a Linux system?

Options:

A.

GPIO

B.

HBA

C.

SCSI

D.

SATA

Question 25

A systems administrator is required to allow only SSH access to the Linux servers from the 192.168.1.0/24 network. Which of the following iptables rules would accomplish this requirement?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 26

The ability to add web servers dynamically during peak user activity and remove them when user activity decreases is an example of:

Options:

A.

configuration automation

B.

build automation

C.

infrastructure automation

D.

inventory management

Question 27

An administrator added a disk to a virtual machine. The administrator attempts to mount the first partition with the following command:

Mount/devsda1/mount_point

The administrator receives the following error message:

Mount: /mount_point: does not exist.

Which of the following BEST solves thrs issue and allows the administrator to run the mount command?

Options:

A.

mount -a

B.

Add the mount point to /etc/ fstab

C.

mount -f /dev/sda1/mount_point

D.

mkdir/mount_point

Question 28

An administrator needs to examine two text files and select identical lines from the files. Which of the following commands wooW BEST accomplish this task?

Options:

A.

cat report1 report2 | awk ' {print $2}' | wc -1

B.

cat report1 report2 | sort | uniq -d

C.

cat report1 report2 | grep -v < report1

D.

cat report1 report2 | sort -u | diff

Question 29

A user deleted a log file because the disk was running out of space on a system running a mission-critical application. Even though the log file was large, the available disk space did not increase. The systems administrator determines the following files are still open:

Which of the following should the systems administrator perform to BEST free up disk space?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 30

A technician needs to install the package, tar,gz, which contains the source code of custom software The technician downloaded the file in /crap Which of the following commands should the technician use to install the executable? (Select Two.)

Options:

A.

tar

B.

gunzip

C.

Idd

D.

configure

E.

apt

F.

make

G.

yum

Question 31

A Linux administrator mounts a directory to a Linux workstation by executing the command mount -t ext4 /dev/sdb /mnt /leg. After rebooting the workstation the mounted device is missing. Which of the following commands should it is mounted after reboot?

Options:

A.

echo "/dev/adb /ant/log ext4 defaults 0 0" » /etc/fstab

B.

fsck /dev/sdb

C.

Ivchange --activate /dev/aab

D.

mkfs.txt4 /dev/sdb

Question 32

A newly deployed application is not able to reach the database that is running on a Linux server. The connection should occur at port 1521/tcp from appsrv 192.168.1.11 to dbsrv

192.168.1.12.

A server administrator runs a few diagnostic commands with following results:

The same command when run from the application server gives the following result:

Both machines are in the same IP subnet, so no external network device is causing the issue.

Which of the following commands BEST solves the connectivity issue at the dbsrv machine? (Select TWO).

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

F.

Option F

Question 33

An administrator is investigating issues with an unresponsive website hosted on an internal web server named websrv. After gathering diagnostics data the administrator performs the following analysis:

Which of the following would MOST likely resolve the issue on the web server?

Options:

A.

Systemct1 restart httpd

B.

Ifup etho

C.

Iptables –I INPUT 1 –p tcp –dport 80 –j ACCETP

D.

Route add default gw 10.0.112.0eth0

Question 34

A Systems administrator needs to examine the output of all kernel-related events since the system was booted. Which of the following would BEST display this information?

Options:

A.

dmesg

B.

modinfo

C.

systemctl

D.

logger

Question 35

A Linux administrator updated the graphics drivers using a package manager but now the server does not boot. Which of the following is the BEST way to get the server back into an operational state?

Options:

A.

Use a system recovery disk to copy the server data to a new system.

B.

Reboot the server with an older kernel version.

C.

Kickstart the server and restore to the last system backup.

D.

Boot a live CD mount and cferoot the boot partition, and run fsck.

Question 36

Whenever an administrator merges the feature branch into master, a binary is created and saved in the artifact repository. Which of the following does this desenbe?

Options:

A.

Build automation

B.

Infrastructure as code

C.

Agentiess architecture

D.

Inventory

Question 37

A Linux administrator tries to ping a hostname in a network but receives the message: hostname not found. The administrator is sure the name exists on the network and wants to verify if the DNS server is correctly configured on the client. Which of the following files should the administrator use to verify this information?

Options:

A.

/etc/named.conf

B.

/etc/resolv.conf

C.

/etc/nsswitch.conf

D.

/etc/network

Question 38

A junior administrator is configuring local name lookups for fully qualified domain names in an isolated environment. The administrator is given a checklist and must accomplish the following tasks:

  • Add localhost with loopback address.
  • Add 192.168.192.12/24 to resolve to database01.comptia.org

Given this scenario, which of the following steps should the administrator perform to accomplish these tasks?

Options:

A.

Open the /etc/nsswitch.conf file with a file editor and add the following lines:

127.0.0.1 localhost

192.168.192.12 database01.comptia.org

B.

Open the /etc/dhcpd.conf file with a file editor and add the following lines:

127.0.0.1 localhost

192.168.192.12 database01.comptia.org

C.

Open the /etc/hosts file with a file editor and add the following lines:

127.0.0.1 localhost

192.168.192.12 database01.comptia.org

D.

Open the /etc/network file with a file editor and add the following lines:

127.0.0.1 localhost

192.168.192.12 database01.comptia.org

Question 39

When requesting SSH access to a remote system, a user accidentally emailed the id_rsa key to the

administrator. Which of the following should the user do NEXT?

Options:

A.

Run the ssh-add command to add the remote system to known_hosts.

B.

Ask the administrator to run chmod 600 id_rsa on the remote system.

C.

Delete id_rsa key file and send the id_rsa.pub key file instead.

D.

Stop using that key and run ssh-keygen to generate a new key pair.

Question 40

A systems administrator is using a Linux laptop to troubleshoot network devices. The administrator runs the

following command:

# screen /dev/USB0

Which of the following does this command MOST likely accomplish?

Options:

A.

It copies the network traffic from the device connected to USB0 and screens out rejected traffic.

B.

It logs all troubleshooting output from the monitor to external USB0 storage.

C.

It monitors USB0 waiting for a network device to be connected to it as an Ethernet device.

D.

It allows the administrator to interact with the character device connected to USB0.

Question 41

A new user has been added to a Linux machine. Which of the following directories would contain the user’s

default files?

Options:

A.

/etc/login.defs

B.

/etc/passwd

C.

/etc/skel

D.

/etc/inittab

Question 42

A systems administrator manually added a new library to the server. The administrator wants to rebuild the

library cache for immediate use.

Which of the following commands should the systems administrator run to achieve this goal?

Options:

A.

make install

B.

ldconfig

C.

make

D.

ldd

Question 43

The following tools help maintain consistency across different systems in an infrastructure:

SUSE Manager

Red Hat Satellite

Spacewalk

If a system file is changed, the tools roll back the file to a predefined configuration.

Which of the following concepts BEST describes this behavior?

Options:

A.

Build automation

B.

Infrastructure as code

C.

Automated configuration management

D.

Agentless system management

Question 44

A Linux administrator recently changed the IP addresses of all the web servers from 10.10.50.x to 10.10.100.x. The administrator needs to update the serverlist.txt file to reflect the change.

The file contains the following:

10:WebSvr01:10.10.50.21:Main

11:WebSvr02:10.10.50.22:Acconting

12:WebSvr03:10.10.50.23:Intranet

20:NFS01:10.10.20.21:FileServer

30:SMTP01:10.10.30.31:Email

Which of the following commands will change the IP addresses and update the files in place?

Options:

A.

sed 's|.50|.100|g' serverlist.txt

B.

sed -g 's|.50|.100|a' serverlist.txt

C.

sed -i 's|.50|.100|' serverlist.txt

D.

sed -i 's|.50|.100|g' serverlist.txt

Question 45

Which of the following default files are typically used to contain a list of public keys from other computers? (Choose two.)

Options:

A.

~/.ssh/authorized_keys

B.

~/.ssh/config

C.

~/.ssh/id_dsa.pub

D.

~/.ssh/known_hosts

E.

~/.ssh/id_rsa

F.

~/.ssh/id_rsa.pub

Question 46

A technician suspects a company's border firewall is down, thus blocking Internet access. The technician executes the following commands:

#ping -c 1 firewall.company.com

64 bytes from firewall.company.com (192.168.1.1): icmp_seq=1 ttl=64 time=0.061ms

#ping -c 16

16 packets transmitted, 0 received, 100% packet loss, time 14999ms

Which of the following commands should the technician use to BEST determine the source of this outage?

Options:

A.

tcpdump

B.

nmap

C.

dig

D.

traceroute

Question 47

An administrator is installing a new kernel but is getting an error indicating the filesystem is out of space. A disk

usage check shows / has plenty of space.

Which of the following BEST represents where the administrator should check next?

Options:

A.

/var

B.

/proc

C.

/boot

D.

/etc

Question 48

An administrator is trying to access a server in a cloud via SSH but is unable to log in. The administrator determines the company’s IP address has been blocklisted on the server.

Which of the following should the administrator do to prevent being blocked in the future?

Options:

A.

Add the company’s TLS certificate to the authorized_keys and known_hosts files.

B.

Modify the cloud provider security rules to allow all connectors form the company’s IP address.

C.

Add the company’s IP address from the /etc/hosts.allow.

D.

Turn on SELinux and enable the SSH context.

Question 49

A user wants to use terminal services from a Windows workstation to manage a Linux server. Which of the following should be installed on the Linux server to enable this functionality?

Options:

A.

VNC

B.

rdesktop

C.

SPICE

D.

XRDP

Question 50

An administrator is installing a Linux VM on a personal hypervisor. The administrator wants to have the VM’s IP address on the same network as the hypervisor host so the VM has the same network properties as the physical interface of the host. To which of the following should the administrator set the network properties?

Options:

A.

Host-only network

B.

NAT network

C.

Bridge network

D.

Overlay network

Question 51

An administrator needs to kill the oldest Bash shell running in the system. Which of the following commands

should be issued to accomplish this task?

Options:

A.

ps axjf | grep bash to obtain PID

kill -9 PID

B.

ps –eo pid,etime,cmd | grep bash (to obtain PID)

kill -9 PID

C.

ps –eo pid,etime| grep bash (to obtain PID)

killall -9 PID

D.

killall -15 -o bash

Question 52

A Linux administrator is configuring a server to log security events for the ping command while allowing the request to occur. The Linux server is using AppArmor to manage its security services.

Which of the following commands is the BEST option?

Options:

A.

aa-complain /bin/ping

B.

aa-disable /bin/ping

C.

aa-unconfined /bin/ping

D.

aa-enforce /bin/ping

Question 53

A corporate server security policy states, “Ensure password hashes are not readable by non-administrative

users.” The administrator should check the permissions on which of the following files to ensure the server

satisfies this policy?

Options:

A.

/etc/shadow

B.

/etc/passwd

C.

/etc/group

D.

/etc/security/limits.conf

Question 54

A directory called /employee is shared with many employees in a company. New hardware was acquired, and the systems administrator needs to back up all files in /employee before the server is replaced.

Which of the following commands should be used to back up all the files and compress them to use little space in the filesystem?

Options:

A.

tar -zcvf backup.tar.gz /employee

B.

tar -zxvf backup.tar.gz /employee

C.

tar -Cvf backup.tar.gz /employee

D.

tar -Tpf backup.tar.gz /employee

Question 55

A user wants to list the lines of a log, adding a correlative number at the beginning of each line separated by a set of dashes from the actual message. Which of the following scripts will complete this task?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 56

An administrator needs to see a list of the system user’s encrypted passwords. Which of the following Linux files does the administrator need to read?

Options:

A.

/etc/shadow

B.

/etc/skel

C.

/etc/passwd

D.

/etc/pw

Question 57

A Linux administrator needs to remotely update the contents of the URL.

Which of the following commands would allow the administrator to download the current contents of the URL before updating?

Options:

A.

curl www.comptia.org/contacts

B.

dig www.comptia.org/contacts

C.

apt-get www.comptia.org/contacts

D.

yum list www.comptia.org/contacts

Question 58

A technician wants to secure a sensitive workstation by ensuring network traffic is kept within the local subnet. To accomplish this task, the technician executes the following command:

echo 0 > /proc/sys/net/ipv4/ip_default_ttl

Which of the following commands can the technician use to confirm the expected results? (Choose two.)

Options:

A.

tcpdump

B.

traceroute

C.

route

D.

iperf

E.

ip

F.

arp

Question 59

A Linux server needs to be accessed, but the root password is not available.

Which of the following would BEST allow an administrator to regain access and set a new known password at the same time?

Options:

A.

Boot into a single-user mode and reset the password via the passwd command.

B.

Boot into a single-user mode and reset the password by editing the /etc/passwd file.

C.

Boot into a single-user mode and reset the password by editing the /etc/shadow file.

D.

Boot into a single-user mode and reset the password via the chage command.

Question 60

A Linux administrator needs the “tech” account to have the option to run elevated commands as root.

Which of the following commands would BEST meet this goal?

Options:

A.

$ su – tech –c “/bin/bash”

B.

# usermod –aG wheel tech

C.

# sudo –I tech

D.

# groupadd –u tech –g root

Question 61

An administrator has written the following Bash script:

All necessary files exist in the correct locations. However, when the administrator executes /home/user/test.sh the following error is received:

No such file or directory

Which of the following is the MOST likely cause of the error?

Options:

A.

The shebang points to the wrong path.

B.

The script is not executable.

C.

The formatting of the file is incorrect.

D.

Nslookup is not installed.

Question 62

A Linux engineer is troubleshooting a newly added SCSI device for a Linux server that needed more disk

space without rebooting. The engineer discovers that the new device is not visible by the Linux kernel in

fdisk -l output. Which of the following commands should be used to rescan the entire SCSI bus?

Options:

A.

echo "- - -" > /sys/class/scsi_host/host0/scan

B.

echo ' ' > /sys/class/scsi_host/host0/scan

C.

echo "- - -" > /sys/scsi/scsi_host/host0/scan

D.

echo "scan" > /sys/class/scsi_host/host0/scan

Question 63

A junior Linux administrator is trying to verify connectivity to the remote host host1 and display round-trip statistics for ten ICMP.

Which of the following commands should the administrator execute?

Options:

A.

ping –c 10 host1

B.

traceroute –c 10 host1

C.

netstat host1

D.

pathping –c 10 host1

Question 64

A Linux administrator needs to switch from text mode to GUI. Which of the following runlevels will start the GUI by default?

Options:

A.

Runlevel 3

B.

Runlevel 4

C.

Runlevel 5

D.

Runlevel 6

Question 65

An administrator needs to mount the shared NFS file system testhost:/testvolume to mount point /mnt/testvol and make the mount persistent after reboot.

Which of the following BEST demonstrates the commands necessary to accomplish this task?

Options:

A.

B.

B.

C.

Question 66

A systems administrator needs to install a new piece of hardware that requires a new driver. The driver should be manually installed. Which of the following describes the order of commands required to obtain module information, install the module, and check the log for any errors during module installation?

Options:

A.

lsmod, modprobe, modinfo

B.

modinfo, insmod, modprobe

C.

modinfo, insmod, dmesg

D.

lsmod, insmod, dmesg

Question 67

An administrator needs to create a shared directory in which all users are able, write, and execute its content but none of the regular users are able to delete any content.

Which of the following permissions should be applied to this shared directory?

Options:

A.

rwxrwxrwt

B.

rwxrwxrws

C.

rwxrwxrwx

D.

rwxrwxrw*

Question 68

A Linux administrator must identify a user with high disk usage. The administrator runs the # du –s /home/* command and gets the following output:

Based on the output, User3 has the largest amount of disk space used. To clean up the file space, the administrator needs to find out more information about the specific files that are using the most disk space.

Which of the following commands will accomplish this task?

Options:

A.

df –k /home/User/files.txt

B.

du –a /home/User3/*

C.

du –sh /home/User/

D.

find . –name /home/User3 -print

Question 69

Which of the following BEST describes the purpose of the X11 system?

Options:

A.

X11 provides graphical display capabilities

B.

X11 provides command line capabilities

C.

X11 provides networking capabilities

D.

X11 provides telephony capabilities.

Question 70

An administrator needs to deploy 100 identical CentOS workstations via PXE boot. Which of the following should the administrator use to minimize the amount of interaction with the consoles needed?

Options:

A.

Kickstart script

B.

Ghost image on a distribution server

C.

Hard disk duplicator

D.

Hard disk duplicator

E.

Ubiquity script

Question 71

While creating a file on a volume, the Linux administrator receives the following message: No space left on device. Running the df –m command, the administrator notes there is still 50% of usage left. Which of the following is the NEXT step the administrator should take to analyze the issue without losing data?

Options:

A.

Run the df –i command and notice the inode exhaustion

B.

Run the df –h command and notice the space exhaustion

C.

Run the df –B command and notice the block size

D.

Run the df –k command and notice the storage exhaustion

Question 72

A systems administrator configured a new kernel module, but it stopped working after reboot. Which of the following will allow the systems administrator to check for module problems during server startup?

Options:

A.

lsmod

B.

modprobe

C.

modinfo

D.

dmesg

Page: 1 / 48
Total 483 questions