oh-my-zsh 已内置 duf 别名,需先执行 unalias duf;从源码编译需 Go 1.23 或更高版本

duf
muesli活跃维护用 Go 写的磁盘空间查看工具,比 df 更直观,以彩色表格列出各挂载点的容量、已用和可用空间,支持 Linux、macOS 和 BSD。
Disk Usage/Free Utility - a better 'df' alternative
brew install dufREADME 未说明,仅需在 Linux、BSD、macOS、Windows 或 Android(termux) 上运行,无 GPU 或显存要求
跨平台磁盘用量查看工具,是 df 的彩色友好替代品
用 Go 写的磁盘空间查看工具,比 df 更直观,以彩色表格列出各挂载点的容量、已用和可用空间,支持 Linux、macOS 和 BSD。
核心能力
- 彩色输出并自适应终端主题与宽度
- 按挂载点、文件系统、类型分组过滤设备
- 支持按 size、usage、inodes 等字段排序
- 可自定义列与红黄绿阈值高亮
- 支持 --json 输出便于脚本处理
容易踩的坑
- v0.9.1最新正式版2025-09-08 · 2025-09-08 20:51 UTC
Changelog
- 2f48dc59d3f7259048817cab4471b419b0aab49d fix: allow manually supplying version/commit again
- 959c8e18e248a63fbc64e4bd2520e8276a79de70 fix: include version number in tarballs
- b2f01a1ecbfd1af63015b83296c50a95260f97b1 fix: parse modified git tree flag correctly
- v0.9.02025-09-07 · 2025-09-07 21:51 UTC
查看更新说明
Changelog
- 4e0b7461ed774494f8fc7d8e7681175dd3cd73e8 fix: 9p path parse error with WSL2 (#300)
- ff7c693678f150cff199026d5a004a121f75a41a fix: deduplicate list of mounts (#209)
- 5784df68209c4abfb22171c8e6a3a33d58bd92da feat: adjust table width to avail space
- e5e76376495fa56f4f073a58e5383749a1abcf3b feat: dynamically resize bars
- 1e9697c637bb3cd73ade48c57bfed8699e78ca3d feat: read build info from runtime
- d0135cc5caf16cf2b3d10684b5c2b1533fc49b2f feat: use unicode chars for bar
- da49faaf671c9c472414a4d8b5bf6a146c29d0bc chore: require Go 1.23+
- v0.8.12022-02-08 · 2022-02-08 06:49 UTC
查看更新说明
Changelog
- f653b78 Add Debian & Ubuntu installation instructions
- 1081e04 Add godoc comments and fix linter warnings
- c834706 Add separate sets of hard- and soft-enforced linters
- 07ee555 Bump go-wildcard to v1.0.3
- 9e15624 Bump mango to v0.1.0
- e98632a Fix mountinfo parsing #153 (#154)
- d0cfccd Unalias term package
- 3c55411 Update README badges
- v0.8.02022-02-01 · 2022-02-01 04:38 UTC
查看更新说明
Changelog
- 067de43 Add 'ansi' theme that uses the terminal's native 4-bit ANSI colors
- c8418ac Add Go 1.17 build tags
- dfb7279 Add dependabot config
- 3fb5666 Add mango-generated man page
- 0b0a5f3 Bump github.com/jedib0t/go-pretty/v6 from 6.2.4 to 6.2.5
- fcdf68d Bump termenv to v0.11.0
- fb2a6e8 Fix manpage workflow branch
- 0e7f1b0 Generate man page when built with 'mango' build-tag
- 9d0af04 Update go-wilcard lib #156
- 161737c table: rename inode-related columns to clarify difference between bytes and inodes. Fixes #94
- v0.7.02022-01-08 · 2022-01-08 10:57 UTC
查看更新说明
Changelog
- af580c4 Add feedback paragraph to README
- 4e52b81 Add install instructions on OpenBSD
- 673a3d1 Add installation instructions for Void Linux
- 43a3776 Add manpage
- cfdc735 Bump go-pretty to v6.2.4
- c170db4 Bump termenv & go-runewidth deps
- ca80cac Document color-coding/threshold options in README
- ab73263 Fix goreportcard badge
- a200812 Hide/show mount points (#107)
- 7795290 Remove unmaintained snap package
- ff3529c Replace deprecated terminal package (#126)
- 8d9557d Update Arch Linux install, in official repos now
- 7ceb395 add availability and usage threhold option
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
duf
Disk Usage/Free Utility (Linux, BSD, macOS & Windows)

Features
- User-friendly, colorful output
- Adjusts to your terminal's theme & width
- Sort the results according to your needs
- Groups & filters devices
- Can conveniently output JSON
Installation
Packages
Linux
- Arch Linux:
pacman -S duf - Ubuntu (22.04 and later) / Debian (12 and later):
apt install duf - Fedora Linux:
dnf install duf - Nix:
nix-env -iA nixpkgs.duf - Void Linux:
xbps-install -S duf - Gentoo Linux:
emerge sys-fs/duf - Solus:
eopkg it duf - Packages in Alpine, Debian & RPM formats
BSD
- FreeBSD:
pkg install duf - OpenBSD:
pkg_add duf
macOS
Windows
- with Chocolatey:
choco install duf - with scoop:
scoop install duf
Android
- Android (via termux):
pkg install duf
Binaries
- Binaries for Linux, FreeBSD, OpenBSD, macOS, Windows
From source
Make sure you have a working Go environment (Go 1.23 or higher is required). See the install instructions.
Compiling duf is easy, simply run:
git clone https://github.com/muesli/duf.git
cd duf
go build
Usage
You can simply start duf without any command-line arguments:
duf
If you supply arguments, duf will only list specific devices & mount points:
duf /home /some/file
If you want to list everything (including pseudo, duplicate, inaccessible file systems):
duf --all
Filtering
You can show and hide specific tables:
duf --only local,network,fuse,special,loops,binds
duf --hide local,network,fuse,special,loops,binds
You can also show and hide specific filesystems:
duf --only-fs tmpfs,vfat
duf --hide-fs tmpfs,vfat
...or specific mount points:
duf --only-mp /,/home,/dev
duf --hide-mp /,/home,/dev
Wildcards inside quotes work:
duf --only-mp '/sys/*,/dev/*'
Display options
Sort the output:
duf --sort size
Valid keys are: mountpoint, size, used, avail, usage, inodes,
inodes_used, inodes_avail, inodes_usage, type, filesystem.
Show or hide specific columns:
duf --output mountpoint,size,usage
Valid keys are: mountpoint, size, used, avail, usage, inodes,
inodes_used, inodes_avail, inodes_usage, type, filesystem.
List inode information instead of block usage:
duf --inodes
If duf doesn't detect your terminal's colors correctly, you can set a theme:
duf --theme light
Color-coding & Thresholds
duf highlights the availability & usage columns in red, green, or yellow, depending on how much space is still available. You can set your own thresholds:
duf --avail-threshold="10G,1G"
duf --usage-threshold="0.5,0.9"
Bonus
If you prefer your output as JSON:
duf --json
Troubleshooting
Users of oh-my-zsh should be aware that it already defines an alias called
duf, which you will have to remove in order to use duf:
unalias duf
Feedback
Got some feedback or suggestions? Please open an issue or drop me a note!