Linux Survival Basics
Find Which Folder Is Filling the Disk
A server is low on disk and you need a quick folder-level view before drilling into files.
Command
du -sh /var/* 2>/dev/null | sort -h
What changed
Nothing changes. The command prints human-readable folder sizes and sorts them.
Danger
safe
When to use it
Use this before deeper `find` searches or cleanup decisions.
When not to use it
Avoid assuming the largest folder is safe to delete; size is not ownership or importance.
Undo or recovery
No state is changed.
Expected output
A sorted list of directory sizes under `/var`.
demo script
Disposable terminal steps
df -hdu -sh /var/* 2>/dev/null | sort -hdu -sh /var/log /var/cache /var/backups 2>/dev/null
simulated output
What it looks like
::fixture-ready::
$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 3.6T 1.2T 2.3T 35% /
tmpfs 64M 0 64M 0% /dev
shm 64M 0 64M 0% /dev/shm
tmpfs 64M 0 64M 0% /tmp
tmpfs 64M 352K 64M 1% /var
/dev/nvme0n1p2 3.6T 1.2T 2.3T 35% /lab/demo.sh
tmpfs 63G 0 63G 0% /proc/asound
tmpfs 63G 0 63G 0% /proc/acpi
tmpfs 63G 0 63G 0% /proc/scsi
tmpfs 63G 0 63G 0% /sys/firmware
tmpfs 63G 0 63G 0% /sys/devices/virtual/powercap
::exit-code::0
$ du -sh /var/* 2>/dev/null | sort -h
64K /var/backups
96K /var/log
192K /var/cache
::exit-code::0
$ du -sh /var/log /var/cache /var/backups 2>/dev/null
96K /var/log
192K /var/cache
64K /var/backups
::exit-code::0
YouTube Short
Find the folder filling your disk.
Start broad. Find the folder that is growing before you chase individual files.
LinkedIn hook
The disk was full. The fastest clue was the folder, not the file.
Question: Do you start disk cleanup with `du` or `find`?
experiments
A/B tests to run
Metric: search_click_rate
A: Find which folder is filling the disk.
B: Start disk cleanup with this broad check.