duf is a modern, terminal-based disk usage tool that replaces the traditional df command. It shows disk usage and free space with color-coded output, auto-adjusts to your terminal width, groups devices by type, and supports JSON output for scripting. If you manage Linux or macOS systems and find df output hard to read, duf is the upgrade you need.
This guide covers installing duf on Ubuntu, Debian, RHEL, Rocky Linux, AlmaLinux, Fedora, and macOS. We walk through practical usage – filtering filesystems, sorting output, exporting to JSON, and hiding mount points you do not care about. The latest stable release is duf 0.9.1 (September 2025).
Prerequisites
- A Linux or macOS system with terminal access
- Root or sudo privileges for package installation
- Package manager available – apt, dnf, brew, or Go 1.23+ for source install
Step 1: Install duf on Linux and macOS
duf is packaged in most major Linux distribution repositories and Homebrew on macOS. Pick the method that matches your system.
Install duf on Ubuntu / Debian
duf is available in the default repositories starting from Ubuntu 22.04 and Debian 12.
sudo apt update
sudo apt install duf
Install duf on RHEL / Rocky Linux / AlmaLinux
On RHEL-based distributions, duf is available in the EPEL repository. Enable EPEL first, then install.
sudo dnf install epel-release -y
sudo dnf install duf -y
Install duf on Fedora
Fedora includes duf in its default repositories.
sudo dnf install duf
Install duf on macOS
On macOS, the easiest path is Homebrew. If you use MacPorts, that works too.
brew install duf
With MacPorts:
sudo port selfupdate && sudo port install duf
Install duf from source with Go
If your distribution does not package duf or you want the latest version, build it from source. You need Go 1.23 or newer installed.
go install github.com/muesli/duf@latest
The binary lands in $GOPATH/bin/ (usually ~/go/bin/). Add it to your PATH if it is not already there.
Verify the installation
Confirm duf is installed and check the version.
duf --version
You should see the installed version printed:
duf 0.9.1
Step 2: Check Disk Usage with duf
Run duf without arguments to see all mounted filesystems. It groups output into local devices, network devices, and special/FUSE filesystems automatically.
duf
The output shows each filesystem with mounted-on path, size, used, available, usage percentage as a color-coded bar, inode info, and filesystem type. Green means plenty of free space, yellow indicates moderate use, and red flags low available space.
To see all filesystems including pseudo and inaccessible ones, use the --all flag.
duf --all
You can also pass specific paths to show only the filesystems those paths belong to.
duf /home /var
Step 3: Filter Filesystems by Type
duf groups filesystems into categories: local, network, fuse, special, loops, and binds. You can show only the types you care about with --only or hide specific types with --hide.
Show only local (physical) disks:
duf --only local
Show only network-mounted filesystems (NFS, CIFS, SSHFS):
duf --only network
Show only FUSE-based filesystems:
duf --only fuse
Show special filesystems like tmpfs, devtmpfs, and proc:
duf --only special
Combine multiple types with commas:
duf --only local,network
Step 4: Sort duf Output
By default, duf sorts by mount point. Use the --sort flag to sort by any column – helpful when you need to find the largest or most-used disks quickly.
Sort by total size (largest first):
duf --sort size
Sort by usage percentage to find the fullest disks:
duf --sort usage
Sort by available space to see which disks are running low:
duf --sort avail
Other valid sort keys: mountpoint, used, inodes, inodes_used, inodes_avail, inodes_usage, type, filesystem.
Step 5: JSON Output for Scripting
duf outputs JSON with the --json flag. This is useful for feeding disk data into monitoring scripts, dashboards, or automated alerting. Pipe the output through jq for readable formatting.
duf --json | jq '.'
The JSON output contains an array of device objects with fields for device name, mount point, filesystem type, total/used/free space in bytes, and inode data. You can filter specific fields with jq – for example, to list mount points and their usage percentage:
duf --json | jq '.[] | {mount_point, total, used, free}'
This makes it straightforward to integrate disk monitoring into your existing Grafana and Telegraf monitoring pipelines or shell-based alerting scripts.
Step 6: Hide Specific Filesystems or Mount Points
On servers with many loop devices, snap mounts, or pseudo filesystems, the default output gets noisy. duf gives you granular control over what to hide.
Hide loop and bind mount devices from the output:
duf --hide loops,binds
Hide specific filesystem types (for example, tmpfs and squashfs from snap packages):
duf --hide-fs tmpfs,squashfs
Hide specific mount points by path – wildcards are supported:
duf --hide-mp '/snap/*,/sys/*,/dev/*'
Show only specific mount points:
duf --only-mp '/,/home,/var'
You can also show only specific filesystem types:
duf --only-fs ext4,xfs,btrfs
Step 7: Show Inode Usage
Running out of inodes is a common problem on systems with millions of small files. duf shows inode information with the --inodes flag.
duf --inodes
This replaces the block usage columns with inode usage columns – total inodes, used, available, and percentage. The same color-coding applies: red means your inode table is nearly full.
Step 8: Compare duf vs df vs lsblk
All three tools show disk information but serve different purposes. Here is how they compare for day-to-day sysadmin work.
df is the traditional POSIX tool available on every Unix system. It shows mounted filesystem usage but the output is plain text with no visual cues. Reading df output across 20+ mount points requires squinting at columns of numbers.
df -hT
lsblk shows block devices and their relationships – disks, partitions, LVM volumes, RAID arrays. It does not show usage percentages or free space. Use it when you need to understand disk layout, not space consumption.
lsblk -f
duf combines the best of both. It shows usage like df but with color-coded bars, groups devices by type (local, network, special), and outputs JSON for automation. It works on Linux, macOS, and FreeBSD with the same interface.
| Feature | df | lsblk | duf |
|---|---|---|---|
| Shows free/used space | Yes | No | Yes |
| Color-coded output | No | No | Yes |
| Groups by device type | No | No | Yes |
| JSON output | No | Yes | Yes |
| Shows disk/partition layout | No | Yes | No |
| Inode info | Yes (df -i) | No | Yes (–inodes) |
| Cross-platform (macOS) | Yes | No | Yes |
| Filter by filesystem type | Yes (df -t) | No | Yes (–only-fs) |
For quick visual disk checks, duf wins. For understanding partition layout, use lsblk. For scripting on systems where you cannot install extra tools, df is always there.
duf Command Reference
Here is a complete reference of all duf flags and what they do.
| Flag | Description |
|---|---|
--all | Include pseudo, duplicate, and inaccessible filesystems |
--hide | Hide specific device groups (local, network, fuse, special, loops, binds) |
--hide-fs | Hide specific filesystem types (e.g., tmpfs, squashfs) |
--hide-mp | Hide specific mount points – supports wildcards |
--inodes | Show inode usage instead of block usage |
--json | Output all data in JSON format |
--only | Show only specific device groups (local, network, fuse, special, loops, binds) |
--only-fs | Show only specific filesystem types (e.g., ext4, xfs) |
--only-mp | Show only specific mount points – supports wildcards |
--output | Select columns to display (mountpoint, size, used, avail, usage, type, filesystem, inodes, inodes_used, inodes_avail, inodes_usage) |
--sort | Sort output by column (mountpoint, size, used, avail, usage, inodes, inodes_used, inodes_avail, inodes_usage, type, filesystem) |
--theme | Set color theme (light, dark, or ANSI) |
--avail-threshold | Set availability color thresholds (e.g., 10G,1G) |
--usage-threshold | Set usage color thresholds as decimals (e.g., 0.5,0.9) |
--version | Print duf version and exit |
Customize duf Output Columns
The --output flag lets you pick exactly which columns to display. This is useful when you want a clean, focused view – for example, just mount point, total size, and usage percentage.
duf --output mountpoint,size,usage
Show mount point, filesystem type, and available space:
duf --output mountpoint,type,avail
Set Usage Thresholds for Alerts
duf color-codes the usage column based on thresholds. The defaults work well, but you can customize them for tighter monitoring. The --usage-threshold flag takes two decimal values – the first triggers yellow, the second triggers red.
duf --usage-threshold "0.5,0.9"
This marks filesystems at 50% usage in yellow and 90% in red. Similarly, set available-space thresholds with --avail-threshold to flag disks with less than a certain amount free.
duf --avail-threshold "10G,1G"
With this setting, disks with less than 10G free show yellow and less than 1G free show red.
Conclusion
duf is a practical replacement for df that makes disk usage information easier to read at a glance. The filtering, sorting, and JSON output features make it equally useful for quick terminal checks and automated monitoring scripts. Install it once, alias it to replace df in your shell profile, and you will not go back.
For production servers, combine duf with ncdu for directory-level disk analysis and proper disk alerting through your monitoring stack. Set usage thresholds that match your capacity planning – 80% warning, 95% critical is a good starting point.