Duf is a useful disk monitoring terminal tool written in Golang. It’s a free and open-source cross-platform tool designed to be a replacement for the df command. It allows you to easily check your disk usage and present it in a much more organized and presentable manner. In this guide, you will learn how to install duf on Ubuntu 20.04
Some of the features of duf include:
- It provides an overview of all the mounted volumes.
- Come in Light or Dark color theme
- Supports JSON output format
- You can list inode information
- Option to sort the output
How to install duf on Ubuntu 20.04
There are two methods you can use to install DUF in Ubuntu. You can install it by downloading and running the Duf Debian package from GitHub or compile the source. Let’s cover each of these in more detail.
Method 1: Install duf on Ubuntu from a Debian package
The easiest way to install DUF is to grab the duf Debian package directly from GitHub and install it using the dpkg package manager. Run the following commands:
$ wget https://github.com/muesli/duf/releases/download/v0.6.0/duf_0.6.0_linux_amd64.deb
$ dpkg -i duf_0.6.0_linux_amd64.deb
Method 2: Install duf from source code
Alternatively, you can install Duf from source. Duf is built in Go, and therefore you need to set up Go version 1.12 or later before compiling duf. Once Go is installed on your Linux system, clone the DUF repository as shown.
$ git clone https://github.com/muesli/duf.git
The compile it from source as shown.
$ cd duf
$ go build
Using duf in Ubuntu
Now, we can start using duf to check disk usage on your Linux system. Simply launch it by using the command duf below:
$ duf
To display all file systems including inaccessible, pseudo and duplicate file systems. Run:
$ duf -all
We can also list specific devices and mount points. In this example, we list the disk usage on the /root partition.
$ duf /root
You can also sort the output to display only certain columns based on the specified keywords.
$ duf --sort size
Valid keywords are: size, mountpoint, avail, usage, inodes, inodes_used, inodes_avail, inodes_usage, type, and filesystem.
We can also show or hide specific columns using the following syntax:
$ duf--output keyword
The following command only displays the mountpoint, size, and usage column.
$ duf --output mountpoint, size, usage
You can change the color themes to either dark or light:
$ duf -theme dark $ duf --theme light
Duf also supports output in JSON format.
$ duf --json
To get more information on the usage of duf, use the –help option :
$ duf --help
As you have seen, duf displays the disk usage statistics in a more intuitive and elegant manner that allows you to easily monitor your mount points and the disk space that you have available. Give it a shot and see the beauty of DUF.