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.
command set
Commands to know
find /var -xdev -type f -printf '%s %p\n'sort -nrhead -20numfmt --to=iec
Watch this command run
Example output from a temporary Linux lab
Find the Files Eating Your Disk
Review the related command card and compare your expected output with the command replay.
Watch command runList Largest Files in a Backup Source
Review the related command card and compare your expected output with the command replay.
Watch command runnext 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.