Mastering duf: Fast, Colorful Disk Usage Tool for Linux, macOS, Windows
This guide introduces duf, a Golang‑based command‑line utility that displays disk usage across Linux, macOS, BSD, Android and Windows, explains its key features, provides step‑by‑step installation methods for various distributions, and demonstrates common usage options and output formats.
What is duf?
duf (Disk Usage/Free) is a lightweight, color‑enhanced command‑line tool written in Go that reports available and used disk space on Unix‑like systems, Windows, and Android. It presents information in a tidy table with optional JSON output.
Key Features
Easy to use
Colorful, adaptive display
Auto‑adjusts height and width to terminal size
Sortable and filterable data
Supports grouping and custom output
JSON output for scripting
Installation
Build from source (requires Go)
git clone https://github.com/muesli/duf.git
cd duf
go buildDebian / Ubuntu (.deb package)
wget https://github.com/muesli/duf/releases/download/v0.5.0/checksums.txt
wget https://github.com/muesli/duf/releases/download/v0.5.0/duf_0.5.0_linux_amd64.deb
sha256sum --ignore-missing -c checksums.txt
sudo dpkg -i duf_0.5.0_linux_amd64.debRPM based distros (CentOS, RHEL, Fedora, OpenSUSE)
wget https://github.com/muesli/duf/releases/download/v0.5.0/duf_0.5.0_linux_amd64.rpm
wget https://github.com/muesli/duf/releases/download/v0.5.0/checksums.txt
sha256sum --ignore-missing -c checksums.txt
rpm -ivh duf_0.5.0_linux_amd64.rpmArch Linux (AUR)
# sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/duf.git
cd duf
less PKGBUILD
makepkg -siAndroid (Termux)
pkg install dufmacOS
Install via Homebrew: brew install duf Or via MacPorts:
sudo port selfupdate && sudo port install dufFreeBSD
sudo sh -c 'pkg update && pkg upgrade && pkg install duf'Windows (Scoop)
scoop install dufBasic Usage
Run duf to list all mounted filesystems with size, used, available, usage percentage, type, and mount point.
Advanced Options
Show a specific mount point: duf /home or duf /home/linuxmi Display all filesystems, including pseudo and inaccessible ones: duf --all Sort output: duf --sort size|used|mountpoint|... (valid keys: mountpoint, size, used, avail, usage, inodes, inodes_used, inodes_avail, inodes_usage, type, filesystem)
Custom columns: duf --output mountpoint,size,usage Show inode information instead of block usage: duf --inodes Switch theme: duf --theme dark or duf --theme light JSON output for scripting:
duf --jsonConclusion
duf is a compact, visually appealing CLI utility that works well on personal Linux desktops, macOS machines, and development servers. It is not recommended for production servers without further evaluation. For more details, consult the project’s GitHub repository.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
