CompTIA XK0-005 CompTIA Linux+ Certification Exam Practice Test

Page: 1 / 14
Total 487 questions
Question 1

A Linux administrator needs to remove all local firewall rules on a Linux system. Which of the following commands should the administrator run?



Answer : C

The iptables -F command flushes all the firewall rules, effectively removing them from the system. This command clears out all existing rules from all chains (INPUT, OUTPUT, and FORWARD), leaving the system with no active iptables rules.


Question 2

[Troubleshooting]

An administrator completes maintenance on a server but cannot remount the logical volume. Given the following output:

# mount /dev/data/files /opt/data/

mount: /opt/data: special device /dev/data/files does not exist.

# lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert

files data -wi-a------ 600.00m

# vgs

VG #PV #LV #SN Attr VSize VFree

data 1 1 0 wz---n- 1020.00m 420.00m

Which of the following commands should the administrator execute to resolve the issue?



Answer : A


Question 3

A Linux administrator is tasked with moving files in a database server. The administrator must not overwrite any existing files. Which of the following commands would indicate that the file already exists?



Answer : A

The -i option stands for 'interactive' and it prompts before overwriting any existing files. This ensures that no existing files are accidentally overwritten during the move operation.


Question 4

A systems administrator is adding a Linux-based server and removing a Windows-based server from a cloud-based environment. The changes need to be validated before they are applied to the cloud-based environment. Which of the following tools should be used to meet this requirement?



Answer : D

Terraform is a tool for building, changing, and managing infrastructure as code in a cloud-based environment. Terraform uses configuration files to describe the desired state of the infrastructure and applies changes accordingly. Terraform supports various cloud providers, such as AWS, Azure, Google Cloud Platform, and more.

To validate changes before they are applied to the cloud-based environment, the administrator can use theterraform plancommand. This command will compare the current state of the infrastructure with the desired state defined in the configuration files and show what actions will be performed to achieve the desired state. This command will not make any changes to the infrastructure but only show a plan of changes. The statement D is correct.

The statements A, B, and C are incorrect because they do not validate changes before they are applied to the cloud-based environment. Ansible is another tool for automating infrastructure management, but it does not have a plan command. Git clone and git pull are commands for working with git repositories, which are used for version control of code.Reference: [How to Use Terraform to Manage Cloud Infrastructure]


Question 5

A Linux administrator needs to create an image named sda.img from the sda disk and store it in the /tmp directory. Which of the following commands should be used to accomplish this task?



Answer : B

The commanddd if=/dev/sda of=/tmp/sda.imgshould be used to create an image named sda.img from the sda disk and store it in the /tmp directory. Theddcommand is a tool for copying and converting data on Linux systems. Theifoption specifies the input file or device, in this case /dev/sda, which is the disk device. Theofoption specifies the output file or device, in this case /tmp/sda.img, which is the image file. The commanddd if=/dev/sda of=/tmp/sda.imgwill copy the entire disk data from /dev/sda to /tmp/sda.img and create an image file. This is the correct command to use to accomplish the task. The other options are incorrect because they either use the wrong options (--ifor--ofinstead ofiforof) or swap the input and output (dd of=/dev/sda if=/tmp/sda.imgordd --of=/dev/sda --if=/tmp/sda.img).Reference:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, page 323.


Question 6

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?



Answer : B

The commandtail -n 20will display the last 20 lines of a file. The-noption specifies the number of lines to show. This is the correct command to execute the task. The other options are incorrect because they either use the wrong options (-v,-c, or-l) or have the wrong arguments (20instead of20 filename).Reference:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 352.


Question 7

A systems administrator receives the following message after running an ip link command to verify the status of a network interface named enp0s3:

state DOWN

Which of the following commands should the administrator use to resolve this issue?



Answer : A


Page:    1 / 14   
Total 487 questions