practice task
Find the Largest Files Under /var
The root filesystem is nearly full and /var looks suspicious. You need a read-only way to find the biggest files without crossing into other mounted filesystems.
Independent study support only. No affiliation, endorsement, exam dumps, or guaranteed exam results.
Try first
find /var -xdev -type f -printf '%s %p\n' | sort -nr | head -20
Goal
List the largest regular files under /var and keep the search on the same filesystem.
Expected output
Rows beginning with byte counts followed by file paths, sorted from largest to smallest. Large logs, caches, or backups should stand out near the top.
Teaches
Use find for precise file selection and sort numerically before deciding what can be archived, truncated, rotated, or removed.
Common mistake
Using du on broad paths without -xdev and accidentally including backup mounts, container volumes, or network filesystems.
check your answer
Answer key
What should your command prove?
Rows beginning with byte counts followed by file paths, sorted from largest to smallest. Large logs, caches, or backups should stand out near the top.
How to explain it
Use find for precise file selection and sort numerically before deciding what can be archived, truncated, rotated, or removed.
What to avoid
Using du on broad paths without -xdev and accidentally including backup mounts, container volumes, or network filesystems.
command set
Commands to know
find /var -xdev -type f -printf '%s %p\n'sort -nrhead -20numfmt --to=iec
answer check
Compare expected output
Open these command examples to compare your answer against realistic output.
next practice
Read Recent Logs for One Service
A service restarted during deploy and is now unhealthy. You need the recent unit logs, not every log line on the machine.