duf
Better df alternative with user-friendly output.
Official WebsiteFeatures
dfInstallation
brew install dufapt install dufpacman -S dufWhy use duf?
duf is a modern and visually superior disk usage display tool that completely replaces the traditional df command. With beautiful table formatting and progress bars, disk status is instantly clear.
Beautiful Table Output
Display in colorful, organized table format. Much more readable than traditional df command.
Progress Bar Display
Visualize usage percentage of each device with progress bars. Quickly see which disks are full.
Device Type Grouping
Automatically group and display local disks, network drives, FUSE mounts, etc.
JSON/CSV Output
Support JSON/CSV format output for easy use in scripts and pipelines. Ideal for automation.
Basic Usage
Display Disk Usage
# Display all mount points
duf
# Display disk information for specific paths
duf /home /var
# Display all file systems (including hidden devices)
duf --allOutput Example
Grouped by device type (local, network, etc.), usage percentages are shown with progress bars and colors.
Common Options
| Option | Description | Example |
|---|---|---|
--all | Display all file systems | duf --all |
--only | Display only specified type | duf --only local |
--hide | Hide specified type | duf --hide special |
--json | Output in JSON format | duf --json |
--output | Specify columns to display | duf --output mountpoint,size,used |
--sort | Specify column to sort by | duf --sort size |
--theme | Specify theme | duf --theme dark |
--width | Specify output width | duf --width 100 |
--inodes | Display inode information | duf --inodes |
Output Formats
JSON Output
Output in JSON format for easy processing in scripts and pipelines.
# Output in JSON format
duf --json
# Extract specific information with jq
duf --json | jq '.[] | select(.mount_point == "/") | .used'
# Extract disks with 80%+ usage
duf --json | jq '.[] | select(.use_percent > 80)'[
{
"device": "/dev/sda1",
"device_type": "local",
"mount_point": "/",
"fs_type": "ext4",
"total": 536870912000,
"free": 161061273600,
"used": 375809638400,
"inodes": 33554432,
"inodes_free": 32000000,
"inodes_used": 1554432,
"use_percent": 70.0,
"inodes_use_percent": 4.6
}
]CSV Output
# Output in CSV format (for spreadsheet or database import)
duf --json | jq -r '.[] | [.device, .mount_point, .total, .used, .use_percent] | @csv'Practical Examples
Filter by Device Type
# Display only local disks
duf --only local
# Display only network volumes
duf --only network
# Display only local and network
duf --only local,network
# Hide special file systems
duf --hide special
# Hide loopback devices
duf --hide loops
# Hide multiple types
duf --hide special,loops,fuse,bindsAvailable device types: local, network, fuse, special, loops, binds
Sorting
# Sort by size
duf --sort size
# Sort by usage percentage
duf --sort usage
# Sort by available space
duf --sort avail
# Sort by file system name
duf --sort filesystem
# Sort by mount point
duf --sort mountpoint
# Reverse sort
duf --sort size --invertCustomize Display Columns
# Specify columns to display
duf --output mountpoint,size,used,avail,usage
# Available columns
# mountpoint - Mount point
# size - Total size
# used - Used space
# avail - Available space
# usage - Usage percentage
# inodes - Inode information
# inodes_used - Used inodes
# inodes_avail - Available inodes
# inodes_usage - Inode usage percentage
# type - File system type
# filesystem - Device name
# Simple display
duf --output mountpoint,usage
# Detailed display
duf --output filesystem,mountpoint,type,size,used,avail,usage,inodes,inodes_usageDisplay Specific Devices or Paths
# Display disk information for specific paths
duf /home /var /tmp
# Display only root partition information
duf /
# Check multiple paths
duf /home /var/log /optDisk Usage Monitoring Script
#!/bin/bash
# Alert if disk usage exceeds 80%
threshold=80
duf --json | jq -r '.[] | select(.use_percent > '"$threshold"') |
"WARNING: (.mount_point) is (.use_percent)% full"' | while read line; do
echo "$line"
# Add actions like email or Slack notifications
doneConfiguration and Customization
Theme Configuration
duf supports multiple color themes.
# Dark theme
duf --theme dark
# Light theme
duf --theme light
# Check available themes
duf --helpConfiguration File
Persist settings in ~/.config/duf/config.json.
{
"hide": ["special", "loops"],
"only": [],
"output": ["mountpoint", "size", "used", "avail", "usage"],
"sort": "usage",
"width": 0,
"theme": "dark",
"inodes": false
}Shell Alias Configuration
# ~/.bashrc or ~/.zshrc
# Replace df with duf
alias df='duf'
# Display only local disks
alias dfl='duf --only local'
# Sort by usage
alias dfs='duf --sort usage'
# Simple display
alias dff='duf --output mountpoint,size,usage'
# JSON output
alias dfj='duf --json'
# Detailed display
alias dfa='duf --all --output filesystem,mountpoint,type,size,used,avail,usage'Comparison with df
| Feature | df | duf |
|---|---|---|
| Color Output | - | Colorful table display |
| Progress Bar | - | Visualize usage percentage |
| Device Grouping | - | Auto group by type |
| JSON Output | - | Native support |
| Filtering | -t, -x options | Intuitive with --only, --hide |
| Sorting | Manual piping required | Easy with --sort |
| Human-Readable Format | -h option required | Default |
| Config File | - | JSON config support |
| Cross-Platform | POSIX only | Linux, macOS, Windows |
Tips and Tricks
- •duf is written in Go and runs as a single binary with no dependencies
- •Use
--hide special,loopsto hide systemd and Docker temporary file systems for better readability - •Combine JSON output with
jqto easily create disk usage monitoring scripts - •Colors and progress bars are automatically disabled when piping or redirecting, so it's safe to use in scripts
- •Colors change based on usage (green→yellow→red). Displays warning color above 80%
- •Display automatically adjusts to terminal width. You can also specify fixed width with
--width - •Create a config file to avoid having to specify options every time