Introduction
df is one of those classic Unix tools that does its job but rarely surprises you with clear output. duf is the modern replacement: same information, but as a colorized table with sensible defaults, categorized mounts (local / network / special), and units humans actually read.
With over 14,000 GitHub stars, duf is the "install once, alias df" kind of tool that quietly makes your shell nicer. Written in Go, it's a single binary, cross-platform, and starts instantly.
What duf Does
duf enumerates mount points (the same way df does) and prints them in three categorized tables: local (real filesystems), network (NFS, SMB, SSH mounts), and special (tmpfs, overlayfs, proc). Each shows size, used %, available, mount point, filesystem type — with colored bars for used percentage.
Architecture Overview
[duf (Go binary)]
|
[Read mount table]
/proc/mounts (Linux), getmntinfo (BSD/macOS), Win32 API
|
[statfs() per mount]
total, free, avail, inodes
|
[Categorize]
local / network / special
|
[Render table]
UTF-8 box drawing + color (respecting NO_COLOR)Self-Hosting & Configuration
# Output in various formats
duf --output mountpoint,size,used,avail,usage # choose columns
duf --json # JSON for scripting
duf --theme dark # force theme (auto/dark/light)
duf --width 160 # wrap at custom width
duf /home /var # only show these paths
# Filter by filesystem type
duf --only-fs ext4,zfs
duf --hide-fs squashfs,tmpfs,devtmpfs
# Sort
duf --sort size
duf --sort usage
# In scripts: JSON output
duf --json | jq '.[] | select(.usage > 0.9)'# Drop-in replace df in aliases
alias df='duf'
# For compatibility, you can also keep df available:
alias df='/usr/bin/df' # real df
alias df2='duf' # pretty dfKey Features
- Categorized tables — local / network / special separated for clarity
- Colorized usage bar — green/yellow/red based on thresholds
- UTF-8 box drawing — clean tables that look great in modern terminals
- JSON output — script-friendly structured data
- Column customization — pick exactly which columns to show
- Sort + filter — by size, usage, filesystem type, mount point
- Cross-platform — Linux, macOS, Windows, BSD
- Theme detection — auto-picks light/dark palette
Comparison with Similar Tools
| Feature | duf | df | discus | dysk | dust |
|---|---|---|---|---|---|
| Purpose | df replacement | POSIX standard | Older colorful df | Newer ncurses-based | du (directory usage) |
| Categorized output | Yes | No | No | Yes | N/A |
| JSON output | Yes | No | No | No | Limited |
| Interactive | No | No | No | Yes | No |
| Best For | Static snapshot | Scripts/universal | Legacy Debian | Live browsing | Disk usage per dir |
FAQ
Q: duf vs dysk? A: Both are df replacements. duf prints a clean static table; dysk (formerly lfs) has an interactive TUI mode for browsing. Many users install both — duf for scripts, dysk for exploration.
Q: Does it work on network mounts? A: Yes — NFS/SMB/SSH mounts appear in the "network" category with proper size accounting. For slow mounts, duf may take a moment per entry (it calls statfs).
Q: Can I use it in shell scripts?
A: Yes — duf --json outputs machine-readable data. For just-a-number output, plain df is still simpler; use duf when you want readable human output in dashboards, reports, or MOTD.
Q: Does it show inode usage?
A: Yes — add --inodes or --output inodes_usage. Essential on filesystems where tiny files can exhaust inodes before bytes.
Sources
- GitHub: https://github.com/muesli/duf
- License: MIT