# dust — A More Intuitive Version of du in Rust > dust (du + Rust = dust) is a modern replacement for the du disk usage command. It provides a visual, color-coded tree view of directory sizes, instantly showing which folders and files consume the most disk space. ## Install Save as a script file and run: # dust — A More Intuitive Version of du in Rust ## Quick Use ```bash # Install dust brew install dust # Or: cargo install du-dust # Show disk usage of current directory dust # Show only top 10 entries dust -n 10 # Show specific directory dust /home/user # Reverse order (smallest first) dust -r # Show apparent size (not disk usage) dust -s # Only show directories (not files) dust -d ``` ## Introduction dust makes disk usage analysis instant and visual. While du requires piping through sort and head, and tools like ncdu require interactive navigation, dust shows a color-coded tree of the largest directories and files in a single command. It is the fastest way to answer "what is using all my disk space?" With over 12,000 GitHub stars, dust is part of the Rust CLI renaissance — modern, fast alternatives to traditional Unix tools (alongside bat, fd, ripgrep, eza, and others). ## What dust Does dust recursively scans a directory, calculates sizes, and displays results as a visual tree with proportional bars showing relative sizes. The largest items appear at the bottom (or top with -r), making it immediately obvious where disk space is being used. ## Architecture Overview ``` [dust /path] | [Recursive Directory Scanner] Walk filesystem tree Calculate sizes | [Sort by Size] Largest entries at bottom | [Visual Output] Tree structure with: - Color-coded bars - Proportional widths - Human-readable sizes - File count per dir Example output: 1.2G ┌── node_modules 340M │ ┌── .git 2.1G ├── project-a 800M ├── project-b 4.5G ┌─┴ /home/user/code ``` ## Self-Hosting & Configuration ```bash # Common usage patterns # Quick overview of home directory dust ~ # Find space hogs in /var sudo dust /var -n 15 # Show only directories (skip individual files) dust -d # Ignore specific directories dust -X node_modules -X .git # Show file count alongside size dust -f # Minimum size threshold dust -z 100M # only show items > 100MB # Show percentage instead of bars dust -p # Combine with other tools dust ~ -n 20 | head -25 # pipe-friendly ``` ## Key Features - **Visual Tree** — color-coded proportional bars show relative sizes - **Instant Results** — no interactive mode, just run and see - **Smart Defaults** — shows the most useful view without flags - **Ignore Patterns** — skip directories like node_modules or .git - **File Count** — optionally show number of files per directory - **Apparent Size** — show actual content size vs disk allocation - **Cross-Platform** — Linux, macOS, and Windows - **Fast** — Rust-powered parallel directory traversal ## Comparison with Similar Tools | Feature | dust | ncdu | du + sort | duf | gdu | |---|---|---|---|---|---| | Interface | Static tree | Interactive TUI | Text | Table | Interactive TUI | | Visual Bars | Yes | Yes | No | Yes (disk) | Yes | | Speed | Very Fast | Fast | Moderate | Fast | Fast | | Interactive | No | Yes (navigate) | No | No | Yes | | Delete Files | No | Yes | No | No | Yes | | Best For | Quick overview | Deep exploration | Scripts | Disk overview | Interactive cleanup | | Language | Rust | C | C (coreutils) | Go | Go | ## FAQ **Q: dust vs ncdu — when should I use which?** A: dust for a quick visual overview (one command, instant answer). ncdu when you need to interactively navigate and delete files. **Q: How do I exclude directories?** A: Use -X flag: "dust -X node_modules -X .git -X target". Multiple -X flags for multiple exclusions. **Q: Can dust show hidden files?** A: Yes, dust shows hidden files by default. Use -i to ignore hidden files if needed. **Q: Why is my total different from df?** A: dust shows file sizes (apparent or allocated). df shows filesystem-level usage including metadata, journals, and reserved space. Use "dust -s" for apparent sizes. ## Sources - GitHub: https://github.com/bootandy/dust - Created by Andy Boot - License: Apache-2.0 --- Source: https://tokrepo.com/en/workflows/82d22b5a-3745-11f1-9bc6-00163e2b0d79 Author: Script Depot