Duf - Check Disk Usage on Linux

Written purely in Go programming language, duf ( Disk Usage Free utility) tool is a free and opensource command-line tool that is an alternative to the df command. It intuitively displays the disk usage statistics of the system in a tabular format with color-coded output. It can be installed on Linux, BSD, Windows, and even macOS.

The duf command-line utility provides features such as:

  1. Intuitive and neat colorful output
  2. Ability to provide output in JSON format.
  3. Provides responsive output that fits neatly on your terminal.
  4. Grouping and filtering devices.
  5. Can sort output according to your preference.

In this tutorial we learn how to install duf on a Ubuntu Linux and how to check disk usage.

1) Install duf utility using snap

Duf is available on snap store and can be installed as a snap package. For a recap, a snap package is an application that ships with all the libraries, and dependencies required for the application to be installed seamlessly.

To install Duf as a snap package, first enable snap on your system.

$ sudo apt update
$ sudo apt install snapd

Then install DUF snap package as shown.

$ sudo snap install duf-utility
install duf on Ubuntu from snap
install duf command-line utility from snap

2) Install duf utility using a Debian package

Alternatively, you can opt to install Duf using the Debian package from the GitHub repository. At the time of writing this guide, the latest version is Duf 0.6.2. So download the Debian package using the wget command as follows.

$ wget  https://github.com/muesli/duf/releases/download/v0.6.2/duf_0.6.2_linux_amd64.deb
Download duf Debian package
Download duf Debian package

Then , install the duf Debian file using the dpkg package manager as follows.

$ sudo dpkg -i duf_0.6.2_linux_amd64.deb
Install duf from Debian package
install duf from Debian package

3) Install duf utility by installing from source

Lastly, you can install duf utility from source by running the following commands. But first, ensure that you have installed GO language on your system. Find the install instructions here.

So, clone the git repository.

$ git clone https://github.com/muesli/duf.git

Then compile from source as shown.

$ cd duf
$ go build

Note: Recommend installing in the test environment and check resource utilization before installing on production.

duf command usage

Once installed, you can launch duf on the terminal by invoking the duf command as follows.

$ duf

This lists all the logical partitions and filesystems as shown.

duf command
duf command

Also, you can narrow down to viewing a single partition such as du /home , du /boot and du / to mention a few examples:

$ duf  /
duf show specific partition
duf show specific partition

Additionally, you can sort the columns to be displayed. For instance, in the example below, we have set the duf command to display the mount point, size of the partition, used space, available space, and the filesystem.

$ duf  --output mountpoint, size, used, avail, filesystem
duf sort columns to be displayed
duf sort columns to be displayed

You can display inodes as follows:

$ duf --inodes
duf display inode number
duf display inode number

To print the output in JSON, execute:

$ duf --json
duf display output in json
duf json output

For more command options run the command:

$ duf --help


As you have seen, the duf utility is a fancy yet helpful way to tracking your disk space usage in an intuitive and user-friendly manner.

Leave a Comment