So your server just screamed “95% full!”—again.
I’ve been there. I once missed my sister’s birthday dinner because a file server at work hit 100 % and everyone was panicking.
Two hours and two lattes later, I was still scrolling through pages of `du` numbers that looked like math-class hallucination.
Why plain `du` feels like a bad treasure map
Run:
du -sh * 2>&1 | sort -h
You get a wall of gray lines. Which folder is the big eater? Which ones just look scary but are harmless? No color, no bars, no clue.
- You’ll probably delete the wrong log file.
- You’ll probably forget to `sudo` and see “Permission denied” 137 times.
- And you’ll definitely lose the rest of the afternoon.
`ncdu` is the Google Maps of disk usage
Instead of raw numbers, `ncdu` draws a simple, side-by-side bar chart.
Tall bars are the disk hogs. Short bars are the little guys you can ignore.
Install in 15 seconds
# Ubuntu/Debian sudo apt install ncdu # CentOS/RHEL sudo yum install ncdu (or) sudo dnf install ncdu # Arch sudo pacman -S ncdu
Done. No three-step build chain or missing “libwhatever273.so” headaches.
Your first walkthrough
- Start at the top: type ncdu /
- Sip coffee while it counts. (On my 500 GB laptop this takes about 30 s.)
- Look at the sorted list. Press Enter to “descend” into a folder, **←** to back out.
- Spot something fat you don’t need, press d, confirm, and boom—space reclaimed.
A typical session:
ncdu 1.16 ~ Use the arrow keys to navigate, press ? for help
--- /home/alice ---------------------------------------------------------
40.3 GiB [##########] .cache
27.5 GiB [###### ] 4K_Movie_Rips
9.2 GiB [## ] node_modules
...
Alice deletes one 15 GB temp cache and one 12 GB season of *The Office* she’s already watched twice. She’s back to 57 % used in three keystrokes.
Pro tricks that pay rent
- Remote server headache:
Runssh root@prod-db "ncdu -o - /"on your laptop and pipe it toncdu -f -. You just browsed 4 TB of data without opening an interactive SSH shell. - Skip noise:
ncdu --exclude /proc --exclude /snap --exclude node_modules / - Save a report:
ncdu -o scan.json /and you can email or archive the snapshot for later. - Daily email alert:
Stick this line in cron and you’ll sleep better.
@daily ncdu -o /root/disk-$(date +\%F).json / 2>&1 | mail -s "Disk check done" ops@example.com
When `du` still makes sense
Bash loop scripts, one-liners in chat-ops, Jenkins jobs—those want less curses and more stdout:
du -ah /var/log | awk '$1 ~ /[0-9][0-9]M|[0-9.]+G/' | sort -hr
But that’s automation land. When the alert fires at 2 a.m. and *you* are the on-call, open `ncdu`. It keeps the coffee in the mug, not your keyboard.
Quick winning routine
Every Monday:
- `ncdu -x /` (the -x stays in the same filesystem)
- Screenshot or export the top 5 biggest directories
- If you’ve caught the same folder two weeks in a row, schedule proper cleanup
I did this for my VPS and caught Docker overlay layers stacked like pancakes before Puppet got there and made it worse.
Stop fearing the alert. Start laughing at it.
Five-minute install, ten minutes of poking around, and you’ll never spend a whole evening crawling through kilobytes again.
The best part? The look on your team’s face when you clear 30 GB in 30 seconds without ssh-ing around like a headless chicken. Pure gold.
FAQ—because I’ve been asked these weekly
Is ncdu safe for production roots?
Yes. It only deletes when you press ‘d’. Think twice, press once.
Can I theme the colors?
Set export NCDU_THEME=3 (choose 0-3) for high-contrast or muted schemes. Your eyes in a dark terminal will thank you.
Does it see hidden files?
Absolutely. It treats dot-folders as first-class citizens.
Mac or Windows person?
`brew install ncdu` on macOS. On Windows, WSL gives you the same ncdu muscle.
No drama, no vendor pitch—just hours back in your week. Install it, try it, thank me later.







