Practice Mode

XK0-006

0/0 Loading...
of 0

XK0-006 — 20 free practice questions

Preview the exam for free. Unlock all 154 questions →

Question 1

A Linux administrator needs to create and then connect to the app-01-image container. Which of the following commands accomplishes this task?
  • A. docker run -it app-01-image Correct
  • B. docker start -td app-01-image
  • C. docker build -ic app-01-image
  • D. docker exec -dc app-01-image

Explanation

docker run creates a new container from the image and starts it, and the -i (keep STDIN open) and -t (allocate a pseudo-terminal) options attach an interactive session to it. docker start only starts an existing container, docker build builds an image from a Dockerfile, and docker exec runs a command in a container that is already running, so none of them both create and connect.

Question 2

To perform a live migration, which of the following must match on both host servers? (Choose two.)
  • A. USB ports
  • B. Network speed
  • C. Available swap
  • D. CPU architecture Correct
  • E. Available memory
  • F. Disk storage path Correct

Explanation

A running virtual machine can only move to a host with a compatible CPU architecture (and feature set), because the guest keeps executing the same instructions after the move. The VM's disk must also be reachable at the same storage path on both hosts, typically shared storage, so the destination can open the same disk images. Network speed, swap and USB ports do not have to match, and the destination only needs enough free memory for the VM, not the same amount as the source.

Question 3

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?
  • 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 Correct
  • C. tar -c -f /home/dev/web.bkp /var/www/html/
  • D. unzip -c /home/dev/web.bkp /var/www/html/

Explanation

pushd changes into /var/www/html/, cpio -idv reads the archive from standard input and extracts it (-i) into the current directory, creating directories as needed (-d), and popd returns to the previous directory. Option A compresses the file with gzip -c instead of decompressing it, so tar receives gzip data rather than an archive. Option C creates a new archive (-c) and would overwrite the backup, and unzip -c only prints the files to standard output instead of extracting them to the directory.

Question 4

Which of the following Ansible components contains a list of hosts and host groups?
  • A. Fact
  • B. Inventory Correct
  • C. Playbook
  • D. Collection

Explanation

An Ansible inventory lists the managed nodes and organizes them into groups that playbooks and ad hoc commands target. Facts are data gathered from the hosts, a playbook defines the plays and tasks to run, and a collection is a distribution format for roles, modules and plugins.

Question 5

Which of the following filesystems contains non-persistent or volatile data?
  • A. /boot
  • B. /usr
  • C. /proc Correct
  • D. /var

Explanation

/proc is a virtual (procfs) filesystem generated by the kernel in memory; it exposes process and kernel information and nothing in it is stored on disk, so it is rebuilt on every boot. /boot, /usr and /var are on persistent storage: /var holds variable data such as logs and spools, but that data survives a reboot.

Question 6

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?
  • A. getent passwd accounting Correct
  • B. id accounting
  • C. grep accounting /etc/shadow
  • D. who accounting

Explanation

getent passwd accounting returns the user's passwd entry from the configured name services, which includes the UID, GID, home directory and login shell. id shows only the UID, GID and group memberships, /etc/shadow holds password hashes and aging data rather than the home directory or shell, and who lists logged-in users.

Question 7

A Linux user needs to download the latest Debian image from a Docker repository. Which of the following commands makes this task possible?
  • A. docker image init debian
  • B. docker image pull debian Correct
  • C. docker image import debian
  • D. docker image save debian

Explanation

docker image pull downloads an image from a registry, and with no tag it fetches the latest tag. docker image import creates an image from a tarball, docker image save writes a local image to a tar archive, and docker image init is not a Docker command.

Question 8

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?
  • A. echo "profile-$(num)-$name"
  • B. echo 'profile-$num-$name'
  • C. echo "profile-`$num`-$name"
  • D. echo "profile-${num}-$name" Correct

Explanation

Braces mark exactly where the variable name begins and ends, so ${num} is expanded as the variable num regardless of the characters around it. $(num) is command substitution and tries to run a command called num, single quotes stop all expansion, and backticks are also command substitution, so they would try to run the variable's value as a command.

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?
  • 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 Correct

Explanation

tail -f follows the log as new lines arrive, and piping it into tee copies standard input both to the screen and to logfile.txt, so the administrator watches the log live and keeps a copy. The > and >> redirections send the output only to the file, so nothing appears on the screen in real time. Piping into logfile.txt is invalid because a pipe needs a command, not a file name.

Question 10

Which of the following describes the method of consolidating system events to a single location?
  • A. Log aggregation Correct
  • B. Health checks
  • C. Webhooks
  • D. Threshold monitoring

Explanation

Log aggregation collects logs and events from many systems and stores them in one central place, where they can be searched and correlated. Health checks test whether a service is up, webhooks send HTTP callbacks when an event occurs, and threshold monitoring raises alerts when a metric crosses a limit. None of those three consolidates events in one location.

Question 11

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?
  • A. setenforce file
  • B. setfacl -m m::t file
  • C. chattr +a file Correct
  • D. chmod +t file

Explanation

chattr +a sets the append-only attribute, so the file can be opened for writing only in append mode: existing data cannot be overwritten or truncated, but new data can be added at the end. setenforce switches the SELinux mode and does not act on a file. chmod +t sets the sticky bit, which controls deletion in directories, and setfacl changes ACL entries, not append behaviour.

Question 12

A systems administrator is configuring new Linux systems and needs to enable passwordless authentication between two of the servers. Which of the following commands should the administrator use?
  • A. ssh-keygen -t rsa && ssh-copy-id -i ~/.ssh/id_rsa.pub john@server2 Correct
  • B. ssh-keyscan -t rsa && ssh-copy-id john@server2 -i ~/.ssh/key
  • C. ssh-agent -i rsa && ssh-copy-id ~/.ssh/key john@server2
  • D. ssh-add -t rsa && scp -rp ~/.ssh john@server2

Explanation

ssh-keygen -t rsa creates an RSA key pair, and ssh-copy-id -i ~/.ssh/id_rsa.pub installs the public key in john's authorized_keys on server2, so later logins use the key instead of a password. ssh-keyscan only collects host keys from servers and does not create a user key. ssh-agent and ssh-add manage keys that are already loaded, and copying the whole ~/.ssh folder with scp would expose the private key without setting up authorized_keys properly.

Question 13

An administrator updates the network configuration on a server but wants to ensure the change will not cause an outage if something goes wrong. Which of the following commands allows the administrator to accomplish this goal?
  • A. netplan try Correct
  • B. netplan rebind
  • C. netplan ip
  • D. netplan apply

Explanation

netplan try applies the new configuration and rolls it back automatically unless the administrator confirms it before the timeout, which is 120 seconds by default. If the change cuts off access, the old configuration comes back without manual work. netplan apply makes the change permanent with no rollback, netplan rebind re-binds interfaces, and netplan ip shows IP leases; neither of those last two tests a change safely.

Question 14

Which of the following best describes journald?
  • A. A system service that collects and stores logging data Correct
  • B. A feature that creates crash dumps in case of kernel failure
  • C. A service responsible for keeping the filesystem journal
  • D. A service responsible for writing audit records to a disk

Explanation

systemd-journald is the systemd service that gathers log messages from the kernel, syslog and service output, and stores them in structured, indexed journals that you read with journalctl. Crash dumps come from kdump, and the filesystem journal is kept by the filesystem itself, for example ext4 or XFS. Audit records are written by auditd.

Question 15

A Linux administrator wants to add a user to the Docker group without changing their primary group. Which of the following commands should the administrator use to complete this task?
  • A. sudo groupmod docker user
  • B. sudo usermod -g docker user
  • C. sudo usermod -aG docker user Correct
  • D. sudo groupmod -G docker user

Explanation

usermod -aG docker user adds docker to the user's supplementary groups and keeps the groups the user already has, because -a appends to the list given with -G. usermod -g would change the user's primary group, which is what the administrator wants to avoid. groupmod changes the properties of a group, not a user's memberships, and it has no -G option for this.

Question 16

Which of the following is a characteristic of Python 3?
  • A. It is closed source.
  • B. It is extensible through modules. Correct
  • C. It is fully backwards compatible.
  • D. It is binary compatible with Java.

Explanation

Python 3 is extended through modules and packages: you import standard-library or third-party modules to add functions without copying their code. Python is open source, under the Python Software Foundation License. Python 3 deliberately broke backward compatibility with Python 2, and it does not run Java bytecode.

Question 17

A systems administrator manages multiple Linux servers and needs to set up a reliable and secure way to handle the complexity of managing event records on the OS and application levels. Which of the following should the administrator do?
  • A. Create an automated process to retrieve logs from the server by demand.
  • B. Implement a centralized log aggregation solution. Correct
  • C. Configure daily automatic backups of logs to remote storage.
  • D. Deploy log rotation procedures to manage the records.

Explanation

A centralized log aggregation solution (for example rsyslog or journald forwarding to a central collector or a SIEM) gathers OS and application events from every server into one secured, searchable place, which is what reliably handles log complexity across many hosts. Pulling logs on demand is manual and misses events if a server fails. Remote backups preserve logs but do not make them manageable or analysable. Log rotation only controls disk usage on each server and does not address multi-server management.

Question 18

Which of the following best describes the role of initrd?
  • A. It is required to connect to the system via SSH.
  • B. It contains basic kernel modules and drivers required to start the system. Correct
  • C. It contains trusted certificates and secret keys of the system.
  • D. It is required to initialize a random device within a Linux system.

Explanation

initrd (initial RAM disk, today usually an initramfs) is a temporary root file system loaded into memory by the boot loader together with the kernel. It holds the basic kernel modules, drivers and scripts needed to reach the real root file system, such as storage, RAID, LVM or encryption support, before control passes to init. It has nothing to do with SSH access, certificate storage or initializing the random device.

Question 19

A Linux systems administrator is running an important maintenance task that consumes a large amount of CPU, causing other applications to slow. Which of the following actions should the administrator take to help alleviate the issue?
  • A. Increase the available CPU time with pidstat.
  • B. Lower the priority of the maintenance task with renice. Correct
  • C. Run the maintenance task with nohup.
  • D. Execute the other applications with the bg utility.

Explanation

renice changes the nice value of a running process, so raising the nice value of the maintenance task lowers its scheduling priority and gives other applications more CPU time while the task still completes. pidstat only reports per-process statistics and cannot add CPU time. nohup only keeps a process running after the terminal closes, and bg only moves a stopped job to the background; neither changes CPU priority.

Question 20

Which of the following is a protocol for accessing distributed directory services containing a hierarchy of users, groups, machines, and organization units?
  • A. SMB
  • B. TLS
  • C. LDAP Correct
  • D. KRB-5

Explanation

LDAP (Lightweight Directory Access Protocol) is the standard protocol for querying and modifying distributed directory services organized as a hierarchy of entries such as users, groups, machines and organizational units. SMB is a file and printer sharing protocol, TLS is a transport encryption protocol, and Kerberos 5 is an authentication protocol that often works alongside a directory but does not provide access to its hierarchy.

Verifying access...