Dust Command in Linux: Quickly Spot Disk‑Space Hoggers
If you’re hunting for that one folder that’s quietly devouring your disk, the dust command is a lean, fast alternative to du or ncdu. It shows sizes in human‑friendly units and lets you drill down quickly. I’ve seen home directories balloon up after a rogue backup script and dust made it easy to cut the clutter.
What Is Dust and Why Use It?
Dust is a Rust‑powered wrapper around du that trims out the noise. Unlike du -h, which prints every single subdirectory, dust defaults to a concise top‑level view and only shows what you care about. When I was cleaning up after installing thousands of development libraries, dust cut my search time from 30 minutes with du into under a minute.
Installing Dust on Linux
# Debian/Ubuntu/Debian‑based distros sudo apt update && sudo apt install -y dust # Fedora / CentOS (EPEL) sudo dnf install -y rust cargo # if you prefer building from source cargo install dust
Why the two options? The package manager version is quick and works out of the box; building with Cargo gives you the latest bleeding‑edge release. If your distro already ships dust, go for it—no extra fuss.
Basic Usage
# Show the 10 largest items in the current directory, human readable dust -d 1 -t 10 . # Recursively scan a specific path and keep only top‑level results dust /var/log
- -d limits depth; -t sets how many entries to display.
- The dot (.) is the current directory, but you can replace it with any path.
Quick Filters for Real‑World Scenarios
- Find large temp files after a build:
dust -d 1 /tmp | grep -i 'build'
- Spot huge home directories on a shared server:
dust -h --max-depth=1 ~/
The --max-depth flag keeps the output tidy, letting you spot oversized users without wading through every subfolder.
Combining Dust with Other Tools
Dust is great for a snapshot, but sometimes you need deeper insight. Pipe its output into awk or sort:
dust -h | sort -hr | head -n 20
That gives you the top 20 items in descending order, perfect for a quick audit before you decide what to delete.
When Dust Is Overkill (and You’re Better Off with du)
If you need raw numbers or scriptable output without formatting, du is still king. Dust adds a layer of niceness—if you just want the exact bytes, stick with du -sb. Also, on very old kernels or minimal containers that lack Rust support, installing dust can be heavier than necessary.
Final Tips
- Keep an eye out for hidden directories (.*) by adding the -a flag.
- Use dust -c to get a cumulative total after your list—quick sanity check that you haven’t missed a huge folder.
- When deleting, double‑check with ls -lh or du -sh to avoid accidental removal of important data.