Monitoring storage capacity and partition allocation is one of the most frequent administrative tasks in Linux. For decades, the standard command has been df -h. While functional, the traditional df utility outputs monochromatic, misaligned columns that blend physical SSDs, network mounts, virtual memory filesystems (tmpfs), and containerised snap loops together in an unstructured wall of text.
duf (Disk Usage/Free Utility) is an open-source, modern command-line alternative written in Go. It presents storage metrics in clean, colour-coded tables featuring visual progress bars, automatic terminal width scaling, and intelligent filesystem grouping. This guide explains how to install, configure, and use duf in Linux.
Key Advantages: duf vs Traditional df
- Visual Progress Bars: Clear graphical utilisation bars immediately highlight nearly full volumes.
- Intelligent Categorisation: Automatically segregates devices into Local Devices, Inode Usage, and Special Filesystems.
- Built-In Filtering: Exclude or isolate pseudo, duplicate, or inaccessible mounts with concise command flags.
- JSON Export: Outputs machine-readable JSON for integration into custom server monitoring scripts.
Installing duf on Linux
Method 1: Distribution Package Managers
# Ubuntu / Debian
sudo apt update && sudo apt install -y duf
# Fedora / Rocky Linux / RHEL
sudo dnf install -y duf
# Arch Linux
sudo pacman -S duf
Method 2: Direct Binary Download (Latest Release)
curl -s https://api.github.com/repos/muesli/duf/releases/latest | grep "browser_download_url.*linux_amd64.deb" | cut -d : -f 2,3 | tr -d \" | wget -qi -
sudo dpkg -i duf_*_linux_amd64.deb
Everyday Usage and Essential Flags
1. Default Overview
Type duf without arguments to display your active mounted filesystems in clean terminal tables:
duf
2. Filtering by Filesystem Category
By default, duf hides pseudo filesystems like tmpfs. To customize visibility:
# Show only physical local storage devices
duf --only local
# Include internal virtual memory and pseudo filesystems
duf --all
3. Sorting Output by Specific Metrics
Identify partition pressure by sorting results by percentage used, total size, or mount path:
# Sort by highest usage percentage first
duf --sort usage
# Sort by largest storage capacity
duf --sort size
Command Options Reference Table
| Flag Switch | Functionality | Example Use Case |
|---|---|---|
--only <type> |
Filters by device class (local, network, fuse, special) |
duf --only local (hide cloud/RAM disks) |
--hide <type> |
Excludes specific categories from tables | duf --hide special |
--inodes |
Displays Inode allocation instead of byte block storage | duf --inodes (troubleshoot zero-space inode exhaustion) |
--json |
Outputs structured JSON array | duf --json | jq '.[0]' |
--theme <style> |
Customises colour palette (dark, light) |
duf --theme light |
Creating a Persistent Shell Alias
To replace the default df command with duf permanently, append an alias to your shell profile:
echo "alias df='duf'" >> ~/.bashrc
source ~/.bashrc