While the traditional df -h command has been the standard for checking available disk space in Unix and Linux environments for decades, its output is often cluttered with pseudofs mounts, Snap squashfs loops, and unformatted tables that require squinting to parse. The duf (Disk Usage/Free) utility is a modern, Go-powered command-line alternative that delivers intuitive, colour-coded storage visualisations, smart terminal width detection, and flexible filtering options.
Why Replace Standard df with duf?
Written by Christian Muehlhaeuser, duf addresses the most common pain points of disk monitoring on modern Linux servers and desktops:
- Automatic Grouping: Organises storage into distinct tables for local devices, specialised storage (such as tmpfs and ramfs), and network filesystems.
- Visual Progress Bars: Displays percentage meters with clear colour thresholds indicating low, warning, and critical disk capacity.
- Intelligent Sorting: Sorts volumes effortlessly by mount point, size, used blocks, or available capacity without piping through external utilities like
sortorawk. - Machine-Readable JSON Output: Supports native
--jsonflags, making it ideal for automation scripts, health checks, and monitoring daemons.
Installing duf on Linux Distributions
The duf binary is available across the standard package repositories of most modern distributions, as well as via Snap and Homebrew.
Ubuntu, Debian, and Linux Mint
On recent versions of Ubuntu (22.04 LTS and newer) and Debian (Bookworm and newer), install duf directly using APT:
sudo apt update
sudo apt install duf
Arch Linux and Manjaro
Arch users can install duf from the official extra repository:
sudo pacman -S duf
Fedora, RHEL, and Rocky Linux
On Fedora and enterprise clones with EPEL enabled, install via DNF:
sudo dnf install duf
Basic Usage and Understanding the duf Output
To inspect your current storage allocation, simply execute duf without any arguments in your terminal:
duf
By default, duf scans your system mounts and produces an organised table containing the following fields:
- DEVICE: The block device path (e.g.,
/dev/nvme0n1p2or/dev/sda1). - MOUNT: The directory where the filesystem is attached (e.g.,
/,/home, or/boot). - TYPE: The filesystem format (e.g.,
ext4,btrfs, orxfs). - TOTAL / USED / AVAIL: Human-readable capacities formatted in standard binary gigabytes and terabytes.
- BAR: An ASCII progress bar illustrating space consumed relative to total capacity.
Filtering Filesystems and Mount Types
One of duf‘s greatest strengths is its ability to include or omit specific filesystem categories:
1. Display Only Local Devices
To exclude tmpfs ramdisks, boot partitions, and temporary filesystems, use the --only-local argument:
duf --only-local
2. Include Inaccessible or Hidden Filesystems
By default, duf omits permission-restricted or zero-byte virtual mounts. To inspect the complete system layout, supply the --all flag:
duf --all
3. Filter by Specific Filesystem Type
You can isolate specific filesystem technologies using the --only-fs flag, or exclude them with --hide-fs. For example, to view only Btrfs and Ext4 filesystems:
duf --only-fs ext4,btrfs
Similarly, you can hide virtual mounts such as vfat or squashfs:
duf --hide-fs vfat,squashfs
Sorting Storage Volumes
Instead of manually searching for the partition closest to capacity, you can instruct duf to sort the table output automatically using the --sort flag:
- Sort by Available Space:
duf --sort avail - Sort by Total Size:
duf --sort size - Sort by Mount Directory:
duf --sort mount - Sort by Usage Percentage:
duf --sort usage
Displaying Inode Usage and Outputting JSON
Running out of free inodes will prevent your Linux server from creating new files, even if gigabytes of physical storage remain free. You can view inode statistics alongside standard block capacity with the --inodes switch:
duf --inodes
For DevOps engineers and sysadmins writing monitoring scripts, duf can output all discovered metrics directly in formatted JSON:
duf --json
This allows you to pipe storage data directly into tools like jq or monitoring agents without tedious regex parsing of text columns, providing an elegant and reliable solution for modern Linux administration.