Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 16 pages
Exam (elaborations)

CompTIA Linux+ XK0-005 Exam Questions and Answers

Document preview thumbnail
Preview 3 out of 16 pages

Pass your CompTIA Linux+ (XK0-005) exam. 40 + 4 questions with verified answers covering all exam domains — vendor-neutral across RHEL, Ubuntu, and SUSE. Topics covered: - Linux filesystem hierarchy: FHS standard, key directories (/etc, /var, /usr, /proc, /home) - File permissions: chmod (numeric and symbolic), chown, chgrp, SUID/SGID/sticky bit, hard links vs symlinks - User management: /etc/passwd, /etc/shadow, useradd, usermod, userdel, sudo, sudoers file (always use visudo) - Process management: ps aux, top, htop, kill/killall/pkill, signals (SIGTERM, SIGKILL, SIGHUP), strace - Package management: apt/apt-get (Debian/Ubuntu), dnf/yum (RHEL/CentOS), zypper (SUSE) — repositories, update vs upgrade - systemd and services: systemctl (start, stop, enable, disable, status), journalctl, daemon management - Networking: SSH key generation (ed25519), /etc/hosts, /etc/, netstat/ss, iptables/nftables/firewalld, curl, wget, nmap - Storage: LVM (PV → VG → LV), RAID levels (0/1/5/10), /etc/fstab, df/du, NFS configuration, LUKS disk encryption - Scripting and text processing: grep, sed, awk, find, tar, rsync — with practical examples - Security: SELinux (enforcing/permissive, contexts, ausearch), AppArmor (profiles, complain mode), file permissions model - Linux boot process: BIOS/UEFI → GRUB → Kernel → initramfs → systemd → target → login - Kernel and modules: lsmod, modprobe, /proc filesystem (cpuinfo, meminfo, sysctl) - Virtualization and containers (XK0-005): container basics relevant to Linux+ scope - Cron jobs: crontab syntax, scheduling examples, system crontabs

Content preview

CompTIA
Linux+
System Administration, Networking, Security, Scripting & Containers for Linux
Exam: XK0-005
40 + 4 Questions & Verified Answers


CompTIA Linux+ — 40 + 4 Exam Questions
Covers all exam domains: System Management, Security, Scripting, Containers & Automation, and
Troubleshooting.


Q01. What is the Linux filesystem hierarchy and what does the root '/' directory represent?
A. The home directory of the root user
B. A partition mounted on /root
C. The root user's personal files
D. The top-level directory of the entire Linux filesystem from which all other directories branch
— containing essential subdirectories like /etc (configs), /var (variable data), /usr (user
programs), /home (user homes), /bin (essential binaries)
Answer: D. Top-level directory of the entire Linux filesystem — contains /etc, /var, /usr,
/home, /bin and all other directories
FHS (Filesystem Hierarchy Standard): defines the directory structure for Linux.
Key directories: /etc (system configuration files), /var (logs, spool, mail — variable data), /usr
(installed programs and libraries), /tmp (temporary files), /proc (virtual filesystem of kernel/process
data).
Root user home: /root (different from / — the root directory of the entire filesystem).
Mounting: attach other filesystems to directories — mount a disk to /mnt, /media, or any directory.


Q02. What is the difference between absolute and relative paths in Linux?
A. Absolute paths use ~ for home; relative paths use /
B. Absolute path starts from the root directory (/home/user/docs/file.txt); relative path starts
from the current directory (docs/file.txt or ../sibling/file.txt) — no leading /
C. Relative paths are faster than absolute paths
D. They are identical in Linux
Answer: B. Absolute = starts from / (full path); relative = starts from current directory (no
leading /)

, Absolute: /etc/nginx/nginx.conf — always the same regardless of where you are in the filesystem.
Relative: ../config/nginx.conf — relative to current working directory. Changes meaning as you
navigate.
Special symbols: . (current directory), .. (parent directory), ~ (home directory of current user).
pwd: print working directory — shows your current absolute path.


Q03. What does the 'chmod' command do and how do numeric permissions work?
A. Changes file ownership to a different user
B. Displays file permission details
C. A command to move files between directories
D. Changes file permissions — numeric mode uses octal: read=4, write=2, execute=1 —
combined per user class (owner/group/other): 755 = rwxr-xr-x, 644 = rw-r--r--
Answer: D. Changes file permissions — numeric octal: read=4, write=2, execute=1 —
combined per class: 755=rwxr-xr-x, 644=rw-r--r--
Octal calculation: 7 = 4+2+1 (rwx), 5 = 4+1 (r-x), 4 = 4 (r--).
755: owner (rwx), group (r-x), other (r-x) — standard for executables and directories.
644: owner (rw-), group (r--), other (r--) — standard for regular files.
Symbolic mode: chmod u+x file (add execute for owner), chmod go-w file (remove write for group
and other).


Q04. What is the purpose of the 'sudo' command?
A. Switch to the superuser account permanently
B. Delete system files safely
C. Run a command as the superuser (root) or another user, with the permission being
controlled by the /etc/sudoers file — providing privilege escalation with audit logging
D. Create a new user account
Answer: C. Run command as root or another user — permissions controlled by /etc/sudoers,
with audit logging
sudo logs every command to syslog/journald — full audit trail of privileged actions.
sudoers file (/etc/sudoers): configure which users can run which commands — edit with 'visudo'
(validates syntax).
sudo -l: list what sudo commands the current user is allowed to run.
su vs sudo: su switches to root shell (no logging per command); sudo runs one command as root
(logged).


Q05. What does the 'grep' command do?
A. Delete lines matching a pattern from a file
B. Display the count of files in a directory
C. Search for patterns in files or input — outputting lines that match the regular expression
pattern
D. Replace text in files globally
Answer: C. Search for patterns in files or input — outputs matching lines
Basic usage: grep 'error' /var/log/syslog — show all lines containing 'error'.

, Common flags: -i (case-insensitive), -r (recursive search in directory), -n (show line numbers), -v
(invert — show non-matching lines), -l (list only filenames), -E (extended regex).
Pipe usage: tail -f /var/log/auth.log | grep 'Failed' — live stream of failed auth attempts.
grep vs egrep vs fgrep: egrep = grep -E (extended regex), fgrep = grep -F (fixed string, no regex).


Q06. What is a Linux daemon and how is it managed with systemd?
A. A graphical user interface process
B. A temporary process that runs once and exits
C. A user-logged-in interactive session
D. A background process that runs continuously providing system services — managed with
systemctl: start, stop, restart, enable (start at boot), disable, status, and journalctl for logs
Answer: D. Background service process — managed with systemctl
(start/stop/enable/disable/status) and journalctl for logs
systemctl start nginx: start the nginx web server.
systemctl enable nginx: configure nginx to start automatically at boot.
systemctl status nginx: view running status, recent log entries, and PID.
journalctl -u nginx: view all logs for the nginx service.
systemd unit files: /etc/systemd/system/ — define how services start, their dependencies, and
restart behavior.


Q07. What is the purpose of SSH and how do you generate SSH keys?
A. A file transfer protocol only
B. A web server protocol
C. A database connection protocol
D. Secure Shell — an encrypted protocol for remote command-line access; generate keys with
'ssh-keygen -t ed25519 -C ' — private key stays on client, public key goes
to ~/.ssh/authorized_keys on the server
Answer: D. Encrypted remote command-line access — generate keys with ssh-keygen,
private key on client, public key on server
SSH key types: ed25519 (recommended, modern), RSA 4096, ECDSA. Avoid RSA 1024.
Copy public key: ssh-copy-id user@server — copies public key to server's authorized_keys
automatically.
SSH config (~/.ssh/config): define Host aliases, IdentityFile, User, Port — simplify connections.
Disable password auth: in /etc/ssh/sshd_config set PasswordAuthentication no — keys only.


Q08. What is the 'ps' command and how does it differ from 'top'?
A. ps lists files; top lists processes
B. ps creates processes; top kills processes
C. ps displays a static snapshot of current processes; top provides a real-time, dynamically-
updating view of processes sorted by CPU/memory usage
D. They are identical commands
Answer: C. ps = static snapshot of processes; top = real-time dynamically updating process
view
ps aux: all processes, all users, with detailed columns (USER, PID, %CPU, %MEM, COMMAND).

Document information

Uploaded on
June 6, 2026
Number of pages
16
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
0
Items
38
Last sold
2 months ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions