Check Disk Usage Using Duf Command-line Utility on Linux

The good old df command sure does a decent job in keeping tabs on the disk space usage.
That's not in doubt.
However, a new tool in the open-source community has come to revolutionize the way we view disk space usage statistics on the terminal.
DUF, an acronym for Disk Usage Free utility, is a free and awesome command-line tool that prints disk usage statistics in an intuitive and fancy format on the terminal.
DUF is developed in the Go programming language and is a cross-platform tool that can be installed in Windows, Linux, BSD ad macOS.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux Monitoring related queries.
In this context, we shall look into how to install DUF and use it to print various disk usage metrics.

How to install DUF on Ubuntu 20.04 LTS ?

Before you get started, ensure you have a Linux distribution with a sudo user configured. Also, confirm that you have a fast and reliable internet connection that will be required for the installation of packages.
There are 3 approaches to installing the DUF utility tool and we shall begin with the easiest.

1. Install DUF using snap packages

The easiest and most straightforward way of installing DUF is using snap packages. But before you go a step further, ensure that snap is enabled. Here's a comprehensive guide on how to enable snap for various Linux flavors https://snapcraft.io/duf-utility.
Once snap is enabled, invoke the following command as the sudo user.

$ sudo snap install duf-utility

Once installed, you will be notified that DUF has successfully been installed.
To confirm the version of DUF installed, run:

$ duf --version 


2. Install DUF from .deb or .rpm packages

DUF Linux packages are also available in both .deb and .rpm packages. To get more insights on the available duf packages and the supported architectures, visit the GitHub releases page.
On Debian / Ubuntu distributions, download the .deb file as follows.
I'm using Ubuntu 20.04 which is a 64-bit system, and so I'll grab the 64-bit Debian package as follows:

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

Once the DUF package is downloaded, run the command:

$ sudo dpkg -i duf_0.6.2_linux_amd64.deb


3. Install DUF from source

Lastly, you can compile DUF from source. But as we pointed out earlier, DUF is written in GO language. So before compiling from source, ensure that you install GO programming language as a prerequisite.
Once installed, proceed and clone the git repo.

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

Navigate into the clone directory.

$ cd duf

And finally, compile the source code as indicated:

$ go build


How to use DUF to check disk usage ?

To begin monitoring disk space usage, simply invoke the duf command as follows:

$ duf

This prints out the disk usage statistics in a color-coded format in a tabular format.
Instead of displaying all the mount points, you can set duf t.
For example, to display disk usage on the root partition only ( / ) run the command:

$ duf /

To display disk usage on the home partition invoke:

$ duf /home

Additionally, you can list the partitions on a single command as follows. This prints out the disk usage statistics on the three partitions indicated.

$ duf / / boot /home

Also, you can filter the columns that you want to display.
For instance, if you want to display the 'Mounted ON' , SIZE, USED, AVAILABLE SPACE, and FILESYSTEM TYPE, run the command:

$ duf --output mountpoint,size,used,avail,type /home

Moreover, you can choose to view the inodes as follows:

$ duf --inodes

To print the output in JSON, run:

$ duf --json

For more options on the command options, use the duf help command as shown.

$ duf --help


[Need urgent assistance in fixing missing packages on Ubuntu Linux Systems? We can help you. ]

This article covers how To View Disk Usage With Duf On Linux And Unix.

Duf is a command line utility to find disk usage in Linux and Unix-like systems.
It displays the disk usage details in a nice tabular-column and user-friendly layout.
You can even get the disk usage output in JSON format as well.

Features of duf Utility:
1. Easy to use
2. Colorful display
3. Adjust height and width as per your terminal resize movement
4. Sorting data as per our need
5. Filters and groups
6. JSON outputs and more

On DEB-based systems such as Debian, Ubuntu, Linux Mint, download the .deb binary installation file from the releases page and install it using your system's package manager.

$ sudo apt install gdebi
$ sudo gdebi duf_0.3.1_linux_amd64.deb

On RPM-based systems such as RHEL, CentOS, Fedora, download the .rpm binary file and install it using command:

$ sudo rpm -Uvh 
duf_0.3.1_linux_amd64.rpm


To View Disk Usage With Duf On Linux And Unix:
All you have to do is just run the duf command without any options like below:

$ duf

Related Posts