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

By Jordan Blake · Updated Jul 10, 2026

Questions25
Passing Score75%
Format100% Multiple Choice
Sessions Logged499
Your progressLog in / Register to track times taken, best score, questions mastered, and coverage on this quiz.
Rating
Community rating 4.1 out of 5 from 10 ratings.
4.1 (10)

Topics covered

This quiz

Uncategorized25 (100%)

Uncategorized25 questions

Discussion

Log in to post a comment, reply, or expand a question.

Q-5804

Question Q-5804 A sysadmin needs to pipe the output of `ps aux`…

2 comments · last active May 31, 2026

  • newsydsyder15 · Jan 12, 11:08 PM

    SSH hardening: key-based auth, disable root login, change port optional, fail2ban for brute force.

  • Snekeke · May 31, 8:48 AM

    /etc/ssh/sshd_config vs ssh_config — server vs client. systemctl restart sshd after edits.

Q-5810

Question Q-5810 A sysadmin needs to check which process is listening on…

2 comments · last active Jan 25, 2026

  • DanderGrimnebulin · Jan 24, 9:41 PM

    Bash script: shebang #!/bin/bash, chmod +x, set -e exit on error. Variables $1 $2 positional params.

    +2 votes
  • BamBamWham · Jan 25, 4:41 PM

    [[ ]] vs [ ] — modern bash prefers [[ for tests. $(command) for subshell capture.

Q-5795

Question Q-5795 A system administrator is configuring firewall rules on a CentOS…

2 comments · last active Jan 24, 2026

  • tedmackey · Jan 23, 6:15 PM

    systemctl start/stop/enable/disable — enable = boot persistence. journalctl -u nginx for service logs.

  • Mr_Worriedasf · Jan 24, 8:15 AM

    SysV init scripts legacy — exam still mentions runlevels vs systemd targets (multi-user.target).

Q-5807

Question Q-5807 An administrator wants to search for the string "ERROR" in…

2 comments · last active Jan 21, 2026

  • Rosichan · Jan 21, 2:12 PM

    cron vs systemd timers — crontab -e for user jobs, /etc/cron.d for packages. @reboot special string.

  • legalthrowawayphila · Jan 21, 9:12 PM

    First five fields: min hour dom month dow. Check system time TZ for scheduled jobs.

Q-5798

Question Q-5798 An administrator needs to configure SELinux to prevent a web…

2 comments · last active Jan 17, 2026

  • waterloo_is_a_meme · Jan 16, 6:43 AM

    grep -r 'pattern' /etc — ripgrep faster in real life but exam says grep. sed/awk for stream edit.

  • ilvovebr · Jan 17, 4:43 AM

    Pipe stderr: 2>&1 | grep error. Know stdout 1 vs stderr 2 file descriptors.

Q-5801

Question Q-5801 A system administrator needs to mount an NFS share `/share/data`…

2 comments · last active Jan 14, 2026

  • SphincterSuprise · Jan 14, 10:07 AM

    SELinux enforcing vs permissive — getenforce, restorecon after moving files breaks contexts. AppArmor on Ubuntu.

  • randomguy7530 · Jan 14, 7:07 PM

    chcon temporary vs semanage fcontext permanent — troubleshoot denials in /var/log/audit/audit.log.

Q-5792

Question Q-5792 An administrator wants to give a script file execute permission…

2 comments · last active Jan 13, 2026

  • parisianjedi · Jan 12, 7:44 PM

    chmod 750 = rwxr-x--- (owner rwx, group rx, other none). Octal: 4 read, 2 write, 1 execute.

  • Blix998 · Jan 13, 12:44 PM

    Setuid bit (4xxx) runs as file owner — /usr/bin/passwd example. Sticky bit on /tmp prevents others deleting your files.

Q-5790

Question Q-5790 A Linux administrator needs to find all files owned by…

2 comments · last active Jan 12, 2026

  • katamari_damacy · Jan 12, 2:00 AM

    find /home -user jdoe -perm -0020 finds group-writable files owned by jdoe — know find predicates (-name, -mtime, -size).

  • TehMojopo · Jan 12, 1:00 PM

    locate uses DB updated by updatedb — faster but not real-time. find is live filesystem walk.

Q-5791

Question Q-5791 A system administrator needs to change the ownership of /data/files…

2 comments · last active Jan 8, 2026

  • FancyMammoth · Jan 8, 3:40 PM

    chown -R user:group /data/files — recursive ownership change. chmod changes mode bits, chown changes owner.

  • ConcernedMLGCustomer · Jan 8, 11:40 PM

    Only root or current owner can chown (unless CAP_FOWNER nuances). Use sudo.

Question catalog for this preview

Catalog listing of the 5 preview questions for this quiz.

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.