# dua — Disk Usage Analyzer with Interactive Terminal UI > dua is a parallelized disk usage analyzer in Rust with an interactive TUI that lets you delete files without leaving the tool, scanning 10× faster than du on modern NVMe drives. ## Install Save as a script file and run: # dua — Disk Usage Analyzer with Interactive Terminal UI ## Quick Use ```bash brew install dua-cli # Non-interactive: top-level sizes dua ~/Downloads # Interactive TUI: navigate + press d to mark for delete dua interactive ~/Projects ``` ## Introduction `du -sh *` works until you hit a 2TB monorepo and your terminal freezes. `dua` (Disk Usage Analyzer) scans in parallel across all cores and gives you an interactive TUI to navigate the tree, mark directories, and delete them in one keystroke — replacing the `du | sort -h | head` + `rm -rf` dance. ## What dua Does - Scans directories in parallel using all CPU cores. - Reports apparent size, hard-link-aware real size, or raw block count. - Provides interactive TUI with keybindings for navigation and deletion. - Supports glob filters and exclude patterns. - Outputs JSON / machine-readable formats. ## Architecture Overview dua uses `walkdir` + `rayon` to fan out the filesystem walk across worker threads. Each worker pushes file metadata into a lock-free channel; the aggregator builds a tree indexed by inode to deduplicate hard links. The TUI is built on `crossterm` + `tui-rs`, recomputing visible rows as you traverse. ## Self-Hosting & Configuration - Install via brew, cargo, apt, dnf, scoop. - `DUA_CPUS=8` tunes worker count (defaults to CPU count). - `--ignore-dirs` skips known caches (node_modules, .git). - `--stay-on-filesystem` avoids crossing mount points. - Exclude globs via `--ignore-patterns`. ## Key Features - Interactive TUI with in-place deletion — rare for a du tool. - Parallel scan scales with NVMe throughput. - Hard-link-aware size calculation. - Multi-root scanning in one invocation. - Three size modes: apparent, real, blocks. ## Comparison with Similar Tools - **du** — POSIX classic; single-threaded, no UI. - **ncdu** — interactive TUI in C; single-threaded. - **gdu** — similar TUI in Go; comparable speed, different keymap. - **dust** — colored bar chart for `du`; non-interactive. - **diskus** — parallel `du -sh`; no TUI. ## FAQ **Q: Safe to delete inside the TUI?** A: Confirmation required; trash integration with `--trash`. **Q: Does it follow symlinks?** A: No by default (`--follow-links` enables). **Q: Network filesystems?** A: Works, but throughput bound by NFS/SMB. **Q: Hard-link accounting?** A: On — only counts inode once. ## Sources - https://github.com/Byron/dua-cli --- Source: https://tokrepo.com/en/workflows/bccf74e7-389d-11f1-9bc6-00163e2b0d79 Author: Script Depot