Skills2026年4月13日·1 分钟阅读

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.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
step-1.md
先审查命令
npx -y tokrepo@latest install 82d22b5a-3745-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
dust shows disk usage as a color-coded visual tree, instantly revealing the largest directories.
§01

What it is

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.

dust is part of the Rust CLI renaissance alongside bat, fd, ripgrep, and eza: modern, fast alternatives to traditional Unix tools. It answers 'what is using all my disk space?' in a single command without piping through sort and head.

§02

How it saves time or tokens

Traditional du requires piping through sort and head to find the largest directories: du -sh * | sort -rh | head -20. ncdu requires interactive navigation. dust shows everything in a single command with proportional visual bars. The output is instantly readable without scrolling or interaction. For AI agents analyzing disk usage, dust's structured output is more parseable than du's raw numbers.

§03

How to use

  1. Install dust:
brew install dust              # macOS
cargo install du-dust           # From source
  1. Show disk usage of the current directory:
dust
  1. Common options:
dust -n 10              # Show only top 10 entries
dust /home/user          # Show specific directory
dust -r                  # Reverse order (smallest first)
dust -s                  # Show apparent size (not disk usage)
dust -d                  # Only show directories (not files)
dust -X .git -X node_modules  # Exclude directories
§04

Example

Typical dust output showing proportional bars:

$ dust -n 8

  4.2G ┌── node_modules      ████████████████████████████████ 48%
  2.1G ├── .git               ████████████████ 24%
  1.0G ├── dist                ████████ 11%
512.0M ├── data                ████ 6%
256.0M ├── logs                ██ 3%
128.0M ├── assets              █ 1%
 64.0M ├── docs                █ 1%
 32.0M ├── src                  0%
  8.8G   ┌── .
§05

Related on TokRepo

§06

Common pitfalls

  • Running dust on the root directory without --depth limit produces an overwhelming amount of output. Use -n to limit entries or -d to hide files.
  • dust shows disk usage by default, which differs from apparent file size due to filesystem block allocation. Use -s for apparent size if you need the actual file sizes.
  • On macOS, some system directories require sudo to scan. Run sudo dust /Library if you need to audit system storage.

常见问题

How does dust differ from du?+

dust provides a visual, color-coded tree with proportional bars. du outputs raw numbers that require piping through sort and head. dust is significantly more readable for finding the largest directories at a glance.

How does dust compare to ncdu?+

ncdu is interactive and requires navigating through directories manually. dust shows the full picture in a single non-interactive command. For scripting and quick lookups, dust is faster. For deep exploration, ncdu offers more interactivity.

Can I exclude directories from the scan?+

Yes. Use the -X flag to exclude directories: dust -X .git -X node_modules. This is useful for excluding known large directories that are not relevant to your analysis.

What platforms does dust support?+

dust runs on macOS, Linux, and Windows. Install via Homebrew (macOS), cargo (all platforms), or download pre-built binaries from the GitHub releases page.

Is dust fast on large filesystems?+

Yes. Written in Rust, dust scans directories efficiently using parallel I/O. It is faster than du on most filesystems and handles large directory trees without issues.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产