How to Install Duf Disk Usage Utility on Ubuntu 20.04
You’ll get the Duf binary up and running, learn a couple of handy flags, and see how to keep it fresh without pulling your hair out. The steps work on a clean 20.04 install as well as on a system that’s already been tweaked with other disk tools.
Grab the latest .deb from GitHub
The easiest way is to pull the pre‑built package rather than compiling yourself.
wget -O duf.deb https://github.com/muesli/duf/releases/download/v0.8.1/duf_0.8.1_linux_amd64.deb
Why: wget saves you a manual download and lets you verify the file name before installing.
Install with dpkg, then fix missing deps
sudo dpkg -i duf.deb || sudo apt-get install -f -y
dpkg does the actual unpacking; if any libraries are missing, apt-get install -f pulls them in automatically. I’ve run into broken installs after a kernel upgrade where the libc version changed – this two‑step dance cleans that up every time.
Verify the installation
duf --version
If you see something like duf 0.8.1, you’re good to go. If not, double‑check that /usr/local/bin (or /usr/bin) is in your $PATH.
Quick start: a glance at your disks
duf -hide /dev/loop*
The -hide flag skips loop devices that clutter the output on a typical Ubuntu desktop. You’ll get a compact table showing mount points, used space, and percentages – all in colour without any extra configuration.
Keep Duf up to date automatically
Ubuntu 20.04’s repos ship an old version, so I like to let a tiny script handle upgrades:
sudo tee /etc/cron.weekly/duf-update <<'EOF'
#!/bin/sh
LATEST=$(curl -s https://api.github.com/repos/muesli/duf/releases/latest | grep tag_name | cut -d '"' -f4)
wget -O /tmp/duf.deb "https://github.com/muesli/duf/releases/download/${LATEST}/duf_${LATEST#v}_linux_amd64.deb"
sudo dpkg -i /tmp/duf.deb && rm /tmp/duf.deb
EOF
sudo chmod +x /etc/cron.weekly/duf-update
The script checks GitHub for the newest tag, downloads the matching .deb, and installs it. It runs weekly, so you never have to remember to chase a new release.
When Duf feels redundant
If you already use ncdu for deep dives into directories, Duf’s one‑liner overview might feel like extra noise. It’s great for a quick sanity check on servers that don’t have a GUI, but on a workstation where you constantly open a file manager the benefit shrinks.