CompTIA Linux+ Certification XK0-005 Exam Practice Test

Page: 1 / 14
Total 487 questions
Question 1

A Linux administrator is adding a new configuration file to a Git repository. Which of the following describes the correct order of Git commands to accomplish the task successfully?



Answer : B

The correct order of Git commands to add a new configuration file to a Git repository is pull -> add -> commit -> push. The pull command will fetch and merge the changes from the remote repository to the local repository, ensuring that the local repository is up to date. The add command will stage the new configuration file for the next commit, marking it as a new file to be tracked by Git. The commit command will create a new snapshot of the project state with the new configuration file and a descriptive message. The push command will publish the commit to the remote repository, updating the remote branch with the new configuration file. The pull -> push -> add -> checkout order is incorrect, as it will not create a commit for the new configuration file, and it will switch to a different branch without pushing the changes. The checkout -> push -> add -> pull order is incorrect, as it will switch to a different branch before adding the new configuration file, and it will overwrite the local changes with the remote changes without creating a commit. The pull -> add -> push -> commit order is incorrect, as it will not create a commit before pushing the changes, and it will create a commit that is not synchronized with the remote branch.:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 20: Writing and Executing Bash Shell Scripts, page 579.


Question 2

An administrator is unable to sync servers to the new NTP server IP address given by the service provider despite several attempts. Looking at the below output

Which of the following commands will help resolve the issue?

A.

B.

C.

D.



Answer : D

The permanent rule --add-service=ntp --permanent is added, but such changes only take effect after a firewall reload.

D is correct: firewall-cmd --reload applies the permanent rule allowing traffic on UDP port 123, and systemctl restart ntpd ensures the NTP daemon is refreshed.

Incorrect Options:

A, B: These commands do not apply firewall rules.

C: --complete-reload is valid but overkill for applying one rule, and rarely used unless debugging.


CompTIA Linux+ XK0-005 Study Guide, Chapter 5

man firewall-cmd

man ntpd

Question 3

A User on a Linux workstation needs to remotely start an application on a Linux server and then forward the graphical display of that application back to the Linux workstation. Which of the following would enable the user to perform this action?



Answer : A

The ssh -X option enables X11 forwarding, which allows the user to run graphical applications on the remote server and display them on the local workstation. The user needs to specify the username, the server address, and the application name after the ssh -X command. The remote server also needs to have X11Forwarding enabled and xauth installed for this to work.

:

The web search result8explains how to run a GUI application through SSH by configuring both the SSH client and server.

The web search result6provides a detailed answer on how to forward X over SSH to run graphics applications remotely, with examples and troubleshooting tips.

The CompTIA Linux+ Certification Exam Objectives mention that the candidate should be able to ''use SSH for remote access and management'' as part of the System Operation and Maintenance domain1.


Question 4

When trying to connect from the bastion host to the remote server, a Linux user always forgets to add some required options in the SSH command line. Which of the following is the best way to permanently solve the user's issue?



Answer : B

~/.ssh/config allows users to define host-specific SSH options like port, user, identity file.


CompTIA Linux+ XK0-005 Study Guide, Chapter 5

man ssh_config

Question 5

A cloud engineer needs to launch a container named web-01 in background mode. Which of the following commands will accomplish this task''



Answer : D

The docker run -d --name web-01 httpd command will launch a container named web-01 in background mode. This command will create and start a new container from the httpd image, assign it the name web-01, and run it in detached mode (-d), which means the container will run in the background without attaching to the current terminal. The docker builder -f --name web-01 httpd command is invalid, as builder is not a valid docker command, and -f and --name are not valid options for docker build. The docker load --name web-01 httpd command is invalid, as load does not accept a --name option, and httpd is not a valid file name for load. The docker ps -a --name web-01 httpd command is invalid, as ps does not accept a --name option, and httpd is not a valid filter for ps.:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 16: Virtualization and Cloud Technologies, page 499.


Question 6

A Linux administrator has been tasked with installing the most recent versions of packages on a RPM-based OS. Which of the following commands will accomplish this task?



Answer : D

The dnf update command will accomplish the task of installing the most recent versions of packages on a RPM-based OS. This command will check for available updates from the enabled repositories and apply them to the system. The apt-get upgrade command is used to install updates on a Debian-based OS, not a RPM-based OS. The rpm -a command is invalid, as -a is not a valid option for rpm. The yum updateinfo command will display information about available updates, but it will not install them. The yum check-update command will check for available updates, but it will not install them.:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Packages and Software, page 559.


Question 7

Employees in the finance department are having trouble accessing the file /opt/work/file. All IT employees can read and write the file. Systems administrator reviews the following output:

Which of the following commands would permanently fix the access issue while limiting access to IT and finance department employees?



Answer : D

The commandsetfacl -m g:finance:rw filewill permanently fix the access issue while limiting access to IT and finance department employees. Thesetfaclcommand is a tool for modifying the access control lists (ACLs) of files and directories on Linux systems. The ACLs are a mechanism that allows more fine-grained control over the permissions of files and directories than the traditional owner-group-others model. The-moption specifies the modification to the ACL. Theg:finance:rwmeans that the group named finance will have read and write permissions on the file. Thefileis the name of the file to modify, in this case /opt/work/file. The commandsetfacl -m g:finance:rw filewill add an entry to the ACL of the file that will grant read and write access to the finance group. This will fix the access issue and allow the finance employees to access the file. The command will also preserve the existing permissions of the file, which means that the IT employees will still have read and write access to the file. This will limit the access to IT and finance department employees and prevent unauthorized access from other users. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not fix the access issue (chattr +i fileorchown it:finance file) or do not limit the access to IT and finance department employees (chmod 666 file).:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing File Permissions and Ownership, page 352.


Page:    1 / 14   
Total 487 questions