The CompTIA Linux+ (XK0-005) certification is one of the most recognized entry-level Linux certifications in the IT industry. It validates that you have the skills to configure, manage, and troubleshoot Linux systems in enterprise environments. This comprehensive study guide covers all four exam domains with practical examples and a structured study plan to help you pass on your first attempt.
Exam Overview
| Detail | Information |
|---|---|
| Exam Code | XK0-005 |
| Questions | 90 (multiple choice + performance-based) |
| Time | 90 minutes |
| Passing Score | 720 out of 900 |
| Cost | $369 USD |
| Recommended Experience | 12+ months hands-on Linux |
Exam Domains and Weights
| Domain | Weight | Topics |
|---|---|---|
| 1. System Management | 32% | Packages, storage, processes, services |
| 2. Security | 21% | Permissions, SSH, firewall, SELinux |
| 3. Scripting & Automation | 19% | Bash, cron, version control |
| 4. Troubleshooting | 28% | Performance, network, boot, logs |
Domain 1: System Management (32% of Exam)
This is the largest domain. You must know package management for both Debian and RHEL families, storage management including LVM, and service management with systemd.
Package Management (Both Families!)
# Debian/Ubuntu (APT / dpkg)
sudo apt update # Refresh package lists
sudo apt upgrade # Upgrade all packages
sudo apt install nginx # Install a package
sudo apt remove nginx # Remove a package
sudo apt autoremove # Remove unused dependencies
dpkg -l # List all installed packages
dpkg -L nginx # List files installed by a package
dpkg -S /usr/bin/nginx # Find which package owns a file
apt-cache search "web server" # Search for packages
apt-cache show nginx # Show package details
# RHEL/CentOS/Fedora (DNF / rpm)
sudo dnf check-update # Check for available updates
sudo dnf upgrade # Upgrade all packages
sudo dnf install httpd # Install a package
sudo dnf remove httpd # Remove a package
sudo dnf list installed # List installed packages
rpm -qa # List all RPM packages
rpm -ql httpd # List files in RPM package
rpm -qf /usr/sbin/httpd # Find which RPM owns a file
dnf search "web server" # Search packages
dnf info httpd # Show package details
User and Group Management
sudo useradd -m -s /bin/bash -G developers john # Create user
sudo passwd john # Set password
sudo usermod -aG sudo john # Add to group
sudo usermod -L john # Lock account
sudo userdel -r john # Delete user + home
sudo groupadd developers # Create group
id john # Show user info
getent passwd john # Query user database
getent group developers # Query group database
Storage and Filesystem Management
# Disk partitioning
lsblk # List block devices
sudo fdisk -l # List partition tables
sudo fdisk /dev/sdb # Partition a disk
sudo parted /dev/sdb # GPT partition management
# Filesystem creation and management
sudo mkfs.ext4 /dev/sdb1 # Create ext4 filesystem
sudo mkfs.xfs /dev/sdb1 # Create XFS filesystem
sudo mount /dev/sdb1 /mnt # Mount filesystem
sudo umount /mnt # Unmount
df -h # Show mounted filesystem usage
du -sh /var/log # Show directory size
sudo fsck /dev/sdb1 # Check filesystem integrity
# /etc/fstab - Persistent mounts
# /dev/sdb1 /data ext4 defaults 0 2
# LVM (Logical Volume Manager) - CRITICAL for exam
sudo pvcreate /dev/sdb1 /dev/sdc1 # Create physical volumes
sudo pvs # List physical volumes
sudo vgcreate myvg /dev/sdb1 /dev/sdc1 # Create volume group
sudo vgs # List volume groups
sudo lvcreate -L 10G -n mylv myvg # Create 10GB logical volume
sudo lvs # List logical volumes
sudo mkfs.ext4 /dev/myvg/mylv # Create filesystem on LV
sudo lvextend -L +5G /dev/myvg/mylv # Extend by 5GB
sudo resize2fs /dev/myvg/mylv # Resize ext4 filesystem
Service Management with systemd
sudo systemctl start nginx # Start service
sudo systemctl stop nginx # Stop service
sudo systemctl restart nginx # Restart service
sudo systemctl reload nginx # Reload config (no downtime)
sudo systemctl enable nginx # Enable at boot
sudo systemctl disable nginx # Disable at boot
sudo systemctl enable --now nginx # Enable AND start
systemctl status nginx # Check status
systemctl is-active nginx # Quick active check
systemctl is-enabled nginx # Quick enabled check
systemctl list-units --type=service # List all services
systemctl --failed # Show failed services
Domain 2: Security (21% of Exam)
File Permissions and Ownership
# Permission basics (read=4, write=2, execute=1)
chmod 755 script.sh # rwxr-xr-x
chmod 644 config.txt # rw-r--r--
chmod u+x file.sh # Add execute for owner
chmod g-w file.txt # Remove write for group
chmod o-rwx file.txt # Remove all for others
chown user:group file.txt # Change owner and group
chown -R user:group /var/www/ # Recursive ownership change
# Special permissions (KNOW THESE for the exam!)
chmod u+s /usr/bin/program # SUID - execute as file owner
chmod g+s /shared/directory # SGID - new files inherit group
chmod +t /tmp # Sticky bit - only owner can delete
# umask - Default permission mask
umask 022 # New files: 644, dirs: 755
umask 077 # New files: 600, dirs: 700
# ACLs (Access Control Lists) - fine-grained permissions
setfacl -m u:john:rw file.txt # Grant john read/write
setfacl -m g:devs:rx dir/ # Grant devs group read/execute
getfacl file.txt # View all ACLs
SSH Security
ssh-keygen -t ed25519 # Generate modern key pair
ssh-copy-id user@server # Copy public key to server
ssh -i ~/.ssh/mykey user@server # Connect with specific key
# /etc/ssh/sshd_config (KNOW THESE settings!)
PermitRootLogin no # Disable root SSH login
PasswordAuthentication no # Force key-based auth
PubkeyAuthentication yes # Enable key auth
MaxAuthTries 3 # Limit login attempts
AllowUsers admin deploy # Restrict SSH access
X11Forwarding no # Disable X11
ClientAliveInterval 300 # Timeout idle sessions
Firewall and SELinux
# UFW (Ubuntu/Debian)
sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw deny 3306/tcp
sudo ufw status verbose
# firewalld (RHEL/CentOS)
sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
firewall-cmd --list-all
# SELinux (KNOW THIS for the exam!)
getenforce # Check mode (Enforcing/Permissive/Disabled)
sudo setenforce 1 # Set to Enforcing
sudo setenforce 0 # Set to Permissive
ls -Z /var/www/ # View file contexts
sudo restorecon -Rv /var/www/ # Restore default contexts
sudo semanage port -a -t http_port_t -p tcp 8080 # Allow custom port
sudo setsebool -P httpd_can_network_connect on # Enable boolean
getsebool -a | grep httpd # List SELinux booleans
# AppArmor (Ubuntu/Debian alternative to SELinux)
sudo aa-status # Check profiles
sudo aa-enforce /etc/apparmor.d/profile # Enforce a profile
Domain 3: Scripting and Automation (19% of Exam)
#!/bin/bash
# Essential scripting concepts for the exam
# Variables
NAME="Linux Admin"
DATE=$(date +"%Y-%m-%d")
FILES=$(ls /var/log/*.log 2>/dev/null | wc -l)
# User input
read -p "Enter server name: " SERVER
# Conditionals
if [ -f "/etc/nginx/nginx.conf" ]; then
echo "Nginx is installed"
elif [ -d "/etc/nginx" ]; then
echo "Nginx directory exists"
else
echo "Nginx not found"
fi
# Test operators (KNOW THESE!)
# -f file exists and is regular file
# -d directory exists
# -e file/directory exists
# -r file is readable
# -w file is writable
# -x file is executable
# -z string is empty
# -n string is not empty
# Numeric comparisons
if [ "$COUNT" -gt 100 ]; then echo "Over 100"; fi
# -eq (equal), -ne (not equal), -lt (less), -gt (greater)
# -le (less or equal), -ge (greater or equal)
# For loop
for server in web01 web02 db01; do
echo "Checking $server..."
done
for file in /var/log/*.log; do
echo "Processing: $file"
done
# While loop
while read -r line; do
echo "Line: $line"
done < /etc/hosts
# Functions
check_service() {
local service=$1
if systemctl is-active "$service" > /dev/null 2>&1; then
echo "$service: RUNNING"
else
echo "$service: STOPPED"
return 1
fi
}
check_service nginx
# Exit codes
echo $? # Last command exit code (0 = success)
exit 0 # Exit script with success
exit 1 # Exit script with failure
# Error handling
set -e # Exit on any error
set -u # Exit on undefined variable
set -o pipefail # Catch pipe failures
Domain 4: Troubleshooting (28% of Exam)
# Performance troubleshooting
top # Interactive process viewer
htop # Better version of top
free -h # Memory usage
vmstat 5 # Virtual memory stats
iostat -x 5 # Disk I/O statistics
uptime # Load averages (1, 5, 15 min)
# Network troubleshooting
ip addr show # IP addresses and interfaces
ip route show # Routing table
ss -tuln # Listening TCP/UDP ports
ss -tunap # All connections with processes
ping -c 4 host # Test connectivity
traceroute host # Trace network path
dig domain.com # DNS lookup
nslookup domain.com # Alternative DNS lookup
host domain.com # Simple DNS lookup
tcpdump -i eth0 port 80 # Capture network packets
# Log analysis
journalctl -u nginx -b # Service logs since boot
journalctl -p err --since today # All errors today
journalctl --since "1 hour ago" # Recent logs
tail -f /var/log/syslog # Follow system log live
grep -i "error" /var/log/syslog # Search for errors
dmesg # Kernel ring buffer messages
# Process management
ps aux # All processes detailed
pgrep -la nginx # Find processes by name
kill PID # Graceful terminate (SIGTERM)
kill -9 PID # Force kill (SIGKILL)
kill -HUP PID # Reload config (SIGHUP)
nice -n 10 command # Start with lower priority
renice 10 -p PID # Change running process priority
nohup command & # Run immune to hangup
Study Plan (8-12 Weeks)
| Week | Focus Area | Study Hours |
|---|---|---|
| 1-2 | System management basics, package management (APT and DNF) | 10-15 |
| 3-4 | Storage, filesystems, LVM, systemd services | 10-15 |
| 5-6 | Security: permissions, SSH, firewall, SELinux/AppArmor | 10-15 |
| 7-8 | Bash scripting, cron automation, git basics | 10-15 |
| 9-10 | Networking and troubleshooting methodology | 10-15 |
| 11-12 | Practice exams, weak area review, hands-on labs | 15-20 |
Tips for Exam Day
- Performance-based questions come first - do not spend too long on them
- Flag difficult questions and return to them later
- Know both Debian AND RHEL command families
- Practice in a VM or cloud server (hands-on experience is crucial)
- Read questions carefully - watch for "NOT" and "EXCEPT" keywords
Recommended Study Books
These books cover all four Linux+ exam domains comprehensively:
Download our CompTIA Linux+ Exam Cheat Sheet for a printable quick-reference with all key commands organized by exam domain.