Text preview & study summary

CompTIA Linux+ XK0-005 - All Domains Linux Administration Security Scripting

A free sample of 5 questions from this quiz, shown in full with answer choices and explanations. No interactivity — everything is visible on this page for study and review.

Want to test your knowledge? Launch the Interactive Exam Simulator

Question 1

A Linux administrator wants to monitor real-time system performance (CPU, memory, disk I/O, network) all in one tool. Which command provides this?

Answer choices

  • A. `top`

  • B. `vmstat`

  • C. `glances` or `htop` (all-in-one monitoring) / `sar` for historical (Correct)

  • D. `iostat`

Explanation

`htop` provides an interactive, color-coded view of CPU, memory, processes. `glances` shows CPU, memory, disk I/O, network, and more in one screen. `top` shows CPU/memory but limited. `vmstat` shows virtual memory stats. `iostat` shows disk I/O. For comprehensive real-time monitoring, htop/glances are preferred.

Question 2

An administrator finds that the /var/log partition is at 98% capacity, causing some services to fail. What is the CORRECT immediate action?

Answer choices

  • A. Delete all logs to free space

  • B. Identify and archive/compress large or old log files using logrotate, compress .gz, or move to archive storage; investigate which service is generating excessive logs (Correct)

  • C. Reboot the server

  • D. Increase the swap space

Explanation

Before deleting logs (potential loss of audit trail/forensic data), identify the source with `du -sh /var/log/* | sort -rh`. Compress old logs (`gzip`), archive to external storage, or configure logrotate to manage rotation. Investigate which service generated the excessive logs to prevent recurrence.

Question 3

A system administrator needs to mount an NFS share `/share/data` from server `192.168.1.100` to `/mnt/data` persistently. Which entry in `/etc/fstab` accomplishes this?

Answer choices

  • A. `192.168.1.100:/share/data /mnt/data nfs defaults 0 0` (Correct)

  • B. `nfs://192.168.1.100/share/data /mnt/data auto defaults 0 0`

  • C. `/mnt/data 192.168.1.100:/share/data nfs rw 0 0`

  • D. `192.168.1.100:/share/data /mnt/data cifs defaults 0 0`

Explanation

/etc/fstab NFS entry format: `[server]:[remote-path] [local-mount] [fs-type] [options] [dump] [pass]`. NFS uses the `nfs` filesystem type. CIFS is for Windows/Samba shares. The URL format is not used in fstab.

Question 4

A DevOps engineer needs to create a Docker container running Nginx, mapping host port 8080 to container port 80, with the container running in the background. Which command is correct?

Answer choices

  • A. `docker run nginx -p 80:8080 -d`

  • B. `docker run -d -p 8080:80 nginx` (Correct)

  • C. `docker start -p 8080:80 nginx`

  • D. `docker exec -d -p 8080:80 nginx`

Explanation

`docker run -d -p 8080:80 nginx` — `-d` runs the container detached (in background), `-p 8080:80` maps host port 8080 to container port 80 (format: host:container). `-p 80:8080` would reverse the mapping (host 80 → container 8080).

Question 5

A Linux administrator needs to install a package from the local filesystem (a .rpm file) on a Red Hat-based system without using a repository. Which command is used?

Answer choices

  • A. `apt install package.rpm`

  • B. `rpm -ivh package.rpm` (Correct)

  • C. `yum install package.rpm` (downloads from repo)

  • D. `dpkg -i package.rpm`

Explanation

`rpm -ivh package.rpm` installs (-i) a local .rpm file verbosely (-v) with progress bar (-h). `yum install` can install local .rpm files too but resolves dependencies from repos. `apt` and `dpkg` are Debian/Ubuntu package tools and don't handle .rpm format.