← 返回 CLI 目录
duf
$ duf 社区开源 低风险 Christian Muehlhaeuser · 文件检索与编辑 · MIT · macos / linux / windows
duf 是跨平台的 Go 版 df 替代工具,可清晰汇总本地、网络与虚拟文件系统。针对 Agent 自动化,duf --json 会输出含精确字节数的结构化挂载元数据,而 --only、--hide 与 --output 可控制范围与字段。
FCRS-1.0 综合评分
92 /100
极佳 (Excellent)
中置信度 (源码/文档)
零摩擦安装命令
brew install duf CLI vs MCP 选型建议 仅 CLI 可用
duf --json 毫秒级返回跨平台磁盘空间统计,无需任何 MCP 封装。
Agent 友好度体检单
✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
Agent 友好度 23 / 25
完全非交互,原生支持 --json、--only/--hide 挂载过滤以及 --output 列选择。
- Native
--jsonoutput with raw byte counts - Supports
--only,--hide,--output, and--sort
安全与权限边界 25 / 25
严格只读的系统挂载检查,零写入与网络副作用。
- Read-only disk capacity inspector
安装与运行摩擦 15 / 15
单静态 Go 二进制,可通过 brew install duf、go install、系统仓库与 GitHub Release 在 macOS、Linux 和 Windows 安装。
- Zero-dependency static binary on all three OSes
能力覆盖与边际价值 13 / 15
通过统一的 --json 输出消除 macOS BSD df 与 Linux GNU df 的参数差异。
- Consistent cross-OS JSON schema
维护与来源背书 8 / 10
广为人知的 MIT 开源 Go 项目(muesli/duf),各大发行版广泛收录。
- Stable, widely packaged Go project
文档与可验证性 8 / 10
README 与 --help 清晰覆盖 --json、--only、--hide 与 --output 参数。
- Concise README and
--helpoutput
安全边界、鉴权与放权指南
鉴权方式
无需鉴权
凭证存储位置
无需凭据;仅读取操作系统挂载与磁盘容量统计信息。
潜在副作用
只读查询
费用与配额提示
100% 免费、离线、开源(MIT)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# duf Agent Rules - Always pass `--json` (and `--only local` to skip virtual/special mounts) when inspecting disk space. - Strictly read-only; safe for automated pre-flight disk checks before builds or downloads.
Agent 高频安全命令配方
只读查询(安全推荐)
以结构化 JSON 检查本地磁盘
duf --only local --json
通过 --only local 仅保留本地挂载点,并以 JSON 输出精确字节容量与挂载路径。
筛选指定列并按可用空间排序
duf --only local --output mountpoint,size,avail,usage --sort avail
使用 --output 限定输出列并按可用字节数只读排序。
核心优势
- + 跨 macOS、Linux 与 Windows 提供统一的
--json输出,消除 BSD 与 GNUdf差异。 - + 严格只读,支持
--only local与--output过滤。
注意事项与踩坑点
- ! 表格模式缺少专门的
--no-color参数(可用--theme ansi缓解,或直接采用--json)。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI