# gdu — Pretty Fast Disk Usage Analyzer Written in Go > gdu is a parallel disk usage analyzer in Go inspired by ncdu, optimized for SSDs, with an interactive TUI, non-interactive mode for CI, and static-binary portability. ## Install Save in your project root: # gdu — Pretty Fast Disk Usage Analyzer Written in Go ## Quick Use ```bash brew install -q gdu # Interactive TUI gdu # Non-interactive, top 10 largest dirs gdu -n /var # Ignore path(s) + output JSON gdu -i /var/log,/tmp --output-file report.json ``` ## 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 -h` shows 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`. ## Sources - https://github.com/dundee/gdu --- Source: https://tokrepo.com/en/workflows/bcef0993-389d-11f1-9bc6-00163e2b0d79 Author: AI Open Source