00:15:00

Free CompTIA Linux+ XK0-005 Practice Test

Prepare for the CompTIA Linux+ XK0-005 exam with this free practice test. Randomly generated and customizable, this test allows you to choose the number of questions.

  • Questions: 15
  • Time: 15 minutes (60 seconds per question)
  • Included Objectives:
    System Management
    Security
    Scripting, Containers, and Automation
    Troubleshooting
Change
Question 1 of 15

A system administrator is working on a container deployment and requires connectivity from the containers to the external network without allocating a public IP address for each container. Which of the following solutions will BEST facilitate this requirement?

  • Implement network address translation at the host level.

  • Configure direct bridge networking for each container.

  • Use layer 2 bridging in conjunction with network address translation.

  • Apply VLAN tagging to the container network interfaces.

Question 2 of 15

As a systems administrator, you have noticed SELinux Access Vector Cache (AVC) denial messages in your system's audit logs, indicating that a legitimate application is being blocked from performing necessary actions. You want to create a custom SELinux module to adjust the policy and allow the application to function as intended. Which command should you use to generate a custom SELinux policy module based on the recorded AVC denials?

  • getenforce > mymodule.te

  • audit2why -M mymodule < /var/log/audit/audit.log

  • audit2allow -M mymodule < /var/log/audit/audit.log

  • semanage module -i mymodule.pp

Question 3 of 15

Alice is working on a Linux server and has navigated through several directories. She wants to confirm the absolute path of the directory she is currently working in before deploying a new application. Which command should she use to display her current directory path?

  • echo $PWD

  • pwd

  • cd

  • ls -d .

Question 4 of 15

A colleague informs you that a new feature has been added to a project, and it's available on the 'feature-login' branch for preview before it's merged into the main codebase. You are currently on the 'main' branch and have made some local modifications that you don't want to commit yet. How would you switch to the 'feature-login' branch to review the new additions without losing your uncommitted changes?

  • git checkout feature-login --force

  • git merge feature-login into your main branch

  • git commit -m 'Temp commit' and then use git checkout feature-login

  • git stash your changes and then use git checkout feature-login

Question 5 of 15

A system administrator is tasked with granting a user named 'johndoe' the ability to run a backup script located at /usr/local/bin/backup.sh without entering a password. To achieve this securely while employing syntax validation, which of the following configurations should the administrator add to the sudoers file using an appropriate command?

  • johndoe ALL=(ALL): NOPASSWD /usr/local/bin/backup.sh

  • johndoe ALL=(ALL) /usr/local/bin/backup.sh

  • ALL johndoe=(ALL) NOPASSWD: /usr/local/bin/backup.sh

  • johndoe ALL=(ALL) ALL

  • johndoe ALL=(ALL) NOPASSWD: /usr/local/bin/backup.sh

  • johndoe /usr/local/bin/backup.sh

Question 6 of 15

When configuring a systemd service unit file, selecting which 'Type' setting will only consider the service started once the process finishes initializing and is ready to accept connections or tasks?

  • notify

  • forking

  • dbus

  • oneshot

  • simple

  • idle

Question 7 of 15

After successfully compiling a program from source code using 'make', which command should be used to install the compiled software into the system-wide directories so that it becomes executable from any location?

  • install make

  • make install

  • make setup

  • make config

Question 8 of 15

An organization is transitioning to a microservices architecture for their cloud-based application, requiring smooth scaling, high availability, and a unified method of configuration. Which Kubernetes feature allows the organization to manage a group of identically configured containers, ensuring they can be scaled easily in response to demand?

  • Service

  • Deployment

  • Pod

  • StatefulSet

Question 9 of 15

A systems administrator needs to investigate an issue in a Docker container that is failing to start correctly. The administrator wishes to view the output logs to diagnose the problem. Which command should the administrator run to display the last 50 lines of logs from the container named 'web-app'?

  • docker inspect --format='{{.LogPath}}' web-app

  • docker logs --tail 50 web-app

  • docker logs -f web-app | tail -50

  • docker container logs web-app --last 50

Question 10 of 15

A system administrator has noticed SELinux is preventing a web application from functioning properly on a production server running the 'targeted' policy. The administrator wants to temporarily relax SELinux enforcement to diagnose the issue without entirely disabling SELinux or making permanent policy changes. Which command should the administrator use to fulfill this requirement?

  • setenforce enforcing

  • setenforce Disabled

  • setenforce 0

  • enforce 0

  • setsebool -P

Question 11 of 15

When working in the terminal, you need to display the absolute path of your current working directory. Which command will provide you with the most accurate and detailed result?

  • ls -a

  • cd -

  • dirname $(pwd)

  • pwd

Question 12 of 15

An administrator wants to monitor disk usage by individual users on a shared system and has decided to utilize the output from the 'du' command. The command 'du -s /home/*' produces a list of directories and their sizes within the /home directory, which is then redirected to 'awk' for further processing. The administrator is interested in directories that consume more than 1GB of disk space. Which 'awk' command should the administrator use to extract and print the usernames (the directory names within /home) and their corresponding disk space usage in gigabytes, but only for those users utilizing more than 1GB?

  • du -s /home/* | awk '{ print $3 ":" $1/1048576 "GB" }'

  • du -s /home/* | awk '{ print substr($2,7) ":" $1 "KB" }'

  • du -s /home/* | awk '{ if $1 > 1048576 print substr($2,7) ":" $1/1048576 "GB" }'

  • du -s /home/* | awk '$1 > 1048576 { print substr($2,7) ":" $1/1048576 "GB" }'

Question 13 of 15

A Linux administrator is deploying an application on Kubernetes and needs to ensure that two containers (a web server and a caching service) share the same network and storage resources. Which of the following is the BEST option to achieve this requirement?

  • Use a DaemonSet to ensure that both containers run on each node in the cluster

  • Create a new Kubernetes service to facilitate communication between two standalone pods

  • Launch separate pods for each container and use a service to link them

  • Deploy both containers within a single pod

Question 14 of 15

You are configuring a Linux server and need to prioritize LDAP for user and group lookups but want to fall back to the local /etc/passwd and /etc/group files if the LDAP lookup fails. Which of the following configurations would you implement in /etc/nsswitch.conf to achieve this requirement?

  • passwd: ldap files group: ldap files

  • passwd: files nis ldap group: files nis ldap

  • passwd: files ldap group: files ldap

  • passwd: nis files ldap group: nis files ldap

Question 15 of 15

A developer wants to deploy a web application and an accompanying database on their local development machine using Docker. Both should be deployed as separate containers but configured to communicate with each other. Which Docker feature allows the definition of this multi-container setup?

  • Kubernetes Pods

  • Docker Swarm

  • Cloud-init

  • Docker Compose