5 Linux Command-Line Drills for the CompTIA Linux+ (XK0-005) Exam
The Linux+ exam doesn't test whether you've read about the command line. It tests whether you can use it — often through performance-based questions where you're dropped into a terminal and told to fix something. Reading man pages won't build that muscle. Drills will.
At Study4Pass, we've watched countless candidates discover that their weakest area wasn't knowledge but fluency: they knew what chmod did, but froze when asked to recursively set permissions under time pressure. These five drills target exactly that gap. Each takes 10–15 minutes. Do them in a disposable VM or container — never on a production system.
Drill 1: Permission Surgery
Permissions questions are everywhere on Linux+. This drill builds the reflex.
# Setup: create a messy tree
mkdir -p ~/drill1/{app,logs,config} && cd ~/drill1
touch app/{run.sh,deploy.sh} logs/{a.log,b.log} config/{app.conf,secret.key}
chmod 777 -R ~/drill1 # start from chaos
# Task 1: scripts executable by owner only, nothing else
chmod 700 app/*.sh
# Task 2: logs readable/writable by owner and group, nothing for others
chmod 660 logs/*
# Task 3: secret.key readable by owner only
chmod 600 config/secret.key
# Task 4: verify with one command
ls -lR ~/drill1
Now do it again with symbolic notation (u=,g=,o=), then with umask variations. The exam loves asking what the resulting permissions are after a umask 027 — drill until you can answer without thinking.
Drill 2: The grep-sed-awk Pipeline Sprint
Text processing is the daily bread of Linux administration and a favorite PBQ topic. Time yourself: 5 minutes per challenge.
# Generate sample data
cat /etc/passwd > ~/users.txt
# Challenge 1: list only usernames of users with /bin/bash shell
grep '/bin/bash' ~/users.txt | cut -d: -f1
# Challenge 2: count how many users use each shell, sorted by count
cut -d: -f7 ~/users.txt | sort | uniq -c | sort -rn
# Challenge 3: with sed, comment out every line starting with '#'
# (practice on a copy!)
sed -i 's/^#/# /' ~/practice.conf # then undo it
# Challenge 4: with awk, print username and UID for UIDs >= 1000
awk -F: '$3 >= 1000 {print $1, $3}' ~/users.txt
The pattern to internalize: grep filters lines, cut/awk selects fields, sort | uniq -c aggregates. If you can chain these without pausing, you're ready.
Drill 3: systemd Triage Under Pressure
Set a timer for 10 minutes. Break a service, then fix it using only systemctl and journalctl.
# Pick a harmless service, e.g. cron or a dummy
sudo systemctl stop cron
sudo systemctl disable cron # simulate "won't start on boot" ticket
# Now triage, as if this were the exam PBQ:
systemctl is-enabled cron
systemctl is-active cron
sudo systemctl enable --now cron
journalctl -u cron --since "10 minutes ago" | tail -20
Repeat with a service that has a broken config (edit a unit file, introduce a typo, run daemon-reload, watch it fail, read the journal, fix it). The exam tests the workflow — check status, read logs, fix, verify — more than any single command.
Drill 4: Storage Tetris with LVM
LVM questions punish anyone who only memorized the commands. Build the muscle:
# Use loop devices or spare partitions in your lab VM — never real disks
# 1. Create two physical volumes, one volume group, one logical volume
# 2. Format it, mount it, write a file
# 3. Extend the LV by 50% and grow the filesystem — without unmounting
# 4. Take an LVM snapshot, delete the file, restore from snapshot
The critical sequence to memorize by doing: pvcreate → vgcreate → lvcreate → mkfs → mount, then lvextend -r (the -r resizes the filesystem in one step — the exam will test whether you know this flag). Snapshots: lvcreate -s. Do the full cycle three times until the order is automatic.
Drill 5: Network Troubleshooting Ladder
Work this ladder top-to-bottom every time, in order, until it's reflex:
ip addr show # 1. Do I have an address?
ip route show # 2. Do I have a route?
ping -c3 8.8.8.8 # 3. Can I reach the internet by IP?
ping -c3 example.com # 4. Does DNS resolve? (if not: check /etc/resolv.conf)
ss -tlnp # 5. Is my service actually listening?
curl -v http://localhost:80 # 6. Does the service respond locally?
Then practice the fix side: bring an interface down/up with ip link set, add a static route with ip route add, restart NetworkManager vs. systemd-networkd, and check firewall-cmd --list-all when a port is "mysteriously" closed. Nine times out of ten, the exam's network PBQ is a firewall or a missing route — the ladder finds it in under two minutes if you've drilled it.
How to Use These
One drill per day, fifteen minutes, in a throwaway VM. Rotate through all five, then repeat the cycle. By the third rotation you'll notice the shift: commands stop being things you remember and start being things your fingers know. That fluency is what performance-based questions actually measure — and it's the difference between a candidate who knows Linux and one who can prove it under pressure.
Top comments (0)