How to Install Duf on Ubuntu Linux

Duf is a modern and user-friendly disk usage/free utility. Installing it on Ubuntu gives you a fast, color-coded snapshot of available, used, and total space across every mounted filesystem. It keeps audits simple for desktops and servers alike when you need to spot filling partitions before running cleanups or expanding storage.

This guide walks through installing Duf on Ubuntu 24.04 and 22.04 LTS from the official Universe repository, including the optional step to enable that component, quick usage examples, and clean removal. Everything stays in the APT flow so updates arrive with the rest of your system.

Update Ubuntu Before Duf Installation

Before installing Duf, update your Ubuntu package index and apply available upgrades. This helps prevent installation issues caused by stale repository data or mismatched dependencies.

To update your system, run the following command:

sudo apt update && sudo apt upgrade

Install Duf via APT

The easiest way to install Duf is by using Ubuntu’s official repositories, which provide a packaged build that updates alongside the rest of your system. Ubuntu 24.04 ships Duf 0.8.x from Universe, while Ubuntu 22.04 provides 0.6.2; the commands below are identical and any minor output differences are version-related.

Run the following command to install Duf on your system:

sudo apt install duf

After installation, confirm the package is present and note which version your release provides:

dpkg -l duf
ii  duf  0.8.x-1ubuntu0.24.04.x  amd64  Disk Usage/Free Utility

On Ubuntu 22.04, expect to see a 0.6.x package string (currently 0.6.2-1ubuntu0.1) in the output instead; both builds come from Universe.

Check which repository APT is using for Duf and verify it comes from Universe (example below is from Ubuntu 24.04):

apt-cache policy duf
duf:
  Installed: 0.8.x-1ubuntu0.24.04.x
  Candidate: 0.8.x-1ubuntu0.24.04.x
  Version table:
 *** 0.8.x-1ubuntu0.24.04.x 500
        500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages

If you see an error such as “Unable to locate package duf” or Universe is missing from the policy output, enable the Universe repository component and run sudo apt update again before retrying the install.

On Ubuntu Desktop, Universe is typically enabled already. On minimal or server installations, install software-properties-common to add the add-apt-repository helper, enable Universe, and refresh your package index:

sudo apt install software-properties-common
sudo add-apt-repository -y universe
sudo apt update

You can also confirm which Ubuntu releases ship Duf and which repository component it comes from on the official Ubuntu package pages: Ubuntu Packages: duf.

Getting Started With Duf: Basic Commands

This section covers the most useful Duf commands so you can filter disks, adjust columns, and export data without guessing flags.

Duf uses standard long options with double dashes (for example, --only-fs and --output); the examples below follow that format for clarity.

Display Disk Usage with Default Settings

Start with the default view to see how Duf formats mounted filesystems with color-coded bars and percentages; run the command below:

duf

Your output will look similar to this example; device names and percentages will differ based on your system:

╭────────────────────────────────────────────────────────────╮
│ 2 local devices                                            │
├────────────────────────────────────────────────────────────┤
│ MOUNTED ON   FILESYSTEM        TYPE  SIZE   USED   AVAIL  USE% │
│ /            /dev/nvme0n1p2    ext4  100G   35G    65G    35%  │
│ /boot        /dev/nvme0n1p1    vfat  512M   70M    442M   14%  │
╰────────────────────────────────────────────────────────────╯

Filter Results by Filesystem Type

Filter the output by filesystem type to focus on the disks that matter (for example, ext4 data partitions) and hide tmpfs or network noise. Use the --only-fs flag followed by the desired filesystem type:

duf --only-fs ext4

This command narrows the table to ext4 filesystems, making it easier to review root and data volumes without temporary mounts in the way.

Customize Output Columns

Customize the columns to surface only the details you need—the order you provide is the order shown. Use the --output flag followed by comma-separated column names:

duf --output size,used,avail,mountpoint

This example focuses on size, used space, available space, and mount points for a concise health check.

Advanced Usage with Multiple Flags

Combine multiple flags to build targeted reports. For example, filter to ext4 filesystems, sort them by size, and keep only the most useful columns:

duf --only-fs ext4 --sort size --output size,used,avail,usage,mountpoint

This filters the view to ext4 volumes, orders them by size, and surfaces usage percentages alongside mount points.

Display All Filesystems

By default, Duf hides pseudo or inaccessible entries so the table stays focused on usable mounts. Use the --all flag to include remote shares, loop devices, and other special filesystems:

duf --all

This command will provide an overview of all filesystems present on your system, which is helpful when you need to audit bind mounts or network paths.

Display Inode Usage

Use --inodes when disk space looks fine but you suspect millions of tiny files are exhausting inode counts. Inodes store metadata about files and directories, so tracking them helps explain “disk full” errors even with free space available:

duf --inodes

The output lists total inodes, how many are used, and the percentage consumed for each mount point.

Display Help and Available Options

To view the help documentation and available options, use the --help flag:

duf --help

This prints the full flag list, including filtering and JSON export options; pipe it through your preferred pager if you want a scrollable view.

For a full list of flags and examples (including JSON output and mountpoint filtering), see the upstream documentation: muesli/duf on GitHub.

Show Version Information

To display the installed version of Duf, use the --version flag:

duf --version

Ubuntu 24.04 reports Duf 0.8.x, while Ubuntu 22.04 shows 0.6.2. Use apt-cache policy duf if you also want the full package string.

Example output for the Duf binary version check:

duf 0.8.x

How to Remove (Uninstall) Duf

If you no longer need Duf, you can remove it and clean up any auto-installed dependencies.

sudo apt remove --purge duf
sudo apt autoremove --purge

APT may report that no additional packages need removal because Duf has minimal dependencies; that output is normal after a straightforward uninstall.

Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Verify Duf is removed:

dpkg -l duf
dpkg-query: no packages found matching duf

Conclusion

This guide covered installing and using Duf on Ubuntu 24.04 and 22.04 LTS. If you’re building out a small terminal-based monitoring toolkit, you may also want to check out how to install htop on Ubuntu for process and resource monitoring alongside disk usage checks.

Leave a Comment