Introduction
gdu is the Go counterpart to dua-cli and ncdu: point it at a mount, it scans with a pool of goroutines, and gives you an interactive TUI to drill into the tree. Its differentiator is fast SSD-tuned scanning, a CI-friendly non-interactive mode, and a tiny static binary you can ship into Alpine-based images.
What gdu Does
- Parallel filesystem scan using goroutines.
- Interactive TUI for navigation and deletion.
- Non-interactive mode emits a top-N summary or JSON.
- Size modes: apparent, real (with blocks), inode count.
- Mount-point aware; can stay on or cross filesystems.
Architecture Overview
gdu uses a worker pool driven by a channel of directory tasks; file stats are aggregated into a tree protected by per-node atomic counters. The TUI uses tview. Non-interactive mode short-circuits the renderer and writes results to stdout or a file.
Self-Hosting & Configuration
- Install via brew, apt (snap), dnf, scoop, or GitHub release.
gdu -hshows flags; config is env-driven (GDU_OUTPUT_FILE, etc.).- Ignore globs via
-I. - Max cores via
GOMAXPROCS. - Alpine-compatible static binary ≈ 4MB.
Key Features
- Fast on SSDs — dozens of goroutines saturate NVMe.
- Works equally well interactive or headless.
- JSON output for dashboards and trending.
- Mount-point awareness for containers.
- Delete and mark features inside TUI.
Comparison with Similar Tools
- ncdu — classic single-threaded TUI.
- dua-cli — Rust equivalent; similar UX.
- dust — read-only bar chart.
- baobab (GNOME) — GUI; not useful on servers.
- df + du combo — scriptable but slow.
FAQ
Q: Does gdu need root? A: Only to see files unreadable by your user.
Q: JSON schema stable? A: Yes; used by Grafana dashboards.
Q: Can I exclude bind mounts?
A: --no-cross stays on the current filesystem.
Q: Works on Windows?
A: Yes — stats reported via os.FileInfo.