Site icon New Generation Enterprise Linux

Find Your Disk Space Hogs In Seconds

Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)

Find Your Disk Space Hogs In Seconds

đź§© The Challenge

Suddenly your monitoring is screaming about /var or /opt being 95% full. You’ve got a hunch it’s some runaway logs or a temp directory, but trying to find the culprit with a plain du -sh * takes forever on a busy server, and then you’re staring at a massive list you have to manually parse. It’s frustrating when you just need a quick answer.

đź’ˇ The Fix

There’s a super fast way to find the biggest directories *one level down* from where you’re currently standing. It’s a simple pipeline that shows you the top offenders immediately, so you can stop scrolling and actually fix the problem.

du -h --max-depth=1 /some/path | sort -rh | head -n 10

⚙️ Why It Works

This little combo first lists immediate subdirectories and files in human-readable format. That output then feeds into sort, which understands those human-readable sizes and orders them from biggest to smallest. head grabs just the top 10 results, so you’re not drowning in irrelevant noise.

🚀 Pro-Tip: Change –max-depth=1 to –max-depth=0 if you just want the total size of the directory itself. Useful for sanity checks!

Linux Tips & Tricks | © ngelinux.com | 11/23/2026

0 0 votes
Article Rating
Exit mobile version