How to Install Duf on Ubuntu 22.04

Duf also called "Disk Usage Free utility" is a free and open-source tool written in Golang. It is used to display disk usage of the system in a tabular format. It is an alternative to the df command and it can be installed on Linux, BSD, Windows, and macOS. It also displays the disk usage details in the JSON output.

In this post, we will show you how to monitor disk usage with the Duf utility on Ubuntu 22.04.

Prerequisites

  • A system with Ubuntu 22.04 installed and running.

  • root access to the system.

Check for System Updates

First, we will update the system to the latest with the following commands,

apt update
apt upgrade

Install Duf

At the time of writing this article, version 0.8.1 was the latest. You can check and download the latest version of .deb source file from their official repository.

We will download using wget command as shown below,

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

Output:

root@vps:~# wget https://github.com/muesli/duf/releases/download/v0.8.1/duf_0.8.1_linux_amd64.deb
--2022-07-11 18:14:42--  https://github.com/muesli/duf/releases/download/v0.8.1/duf_0.8.1_linux_amd64.deb
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 917644 (896K) [application/octet-stream]
Saving to: ‘duf_0.8.1_linux_amd64.deb’

duf_0.8.1_linux_amd 100%[===================>] 896.14K  --.-KB/s    in 0.08s

2022-07-11 18:14:42 (11.3 MB/s) - ‘duf_0.8.1_linux_amd64.deb’ saved [917644/917644]

Install the downloaded .deb source file using the dpkg command,

apt install dpkg
dpkg -i duf_0.8.1_linux_amd64.deb

Output:

root@vps:~# dpkg -i duf_0.8.1_linux_amd64.deb
Selecting previously unselected package duf.
(Reading database ... 71656 files and directories currently installed.)
Preparing to unpack duf_0.8.1_linux_amd64.deb ...
Unpacking duf (0.8.1) ...
Setting up duf (0.8.1) ...

Using the Duf Command Utility

We will now try using the duf command on the terminal to get disk-related information.

duf

Output:

root@vps:~# duf
╭────────────────────────────────────────────────────────────────╮
│ 1 local device                                                 │
├────────────┬───────┬──────┬───────┬────────┬──────┬────────────┤
│ MOUNTED ON │  SIZE │ USED │ AVAIL │  USE%  │ TYPE │ FILESYSTEM │
├────────────┼───────┼──────┼───────┼────────┼──────┼────────────┤
│ /          │ 48.7G │ 2.5G │ 43.7G │   5.0% │ ext4 │ /dev/vda3  │
╰────────────┴───────┴──────┴───────┴────────┴──────┴────────────╯
╭────────────────────────────────────────────────────────────────────────────╮
│ 7 special devices                                                          │
├────────────────┬────────┬────────┬────────┬────────┬──────────┬────────────┤
│ MOUNTED ON     │   SIZE │   USED │  AVAIL │  USE%  │ TYPE     │ FILESYSTEM │
├────────────────┼────────┼────────┼────────┼────────┼──────────┼────────────┤
│ /dev           │ 947.7M │     0B │ 947.7M │        │ devtmpfs │ udev       │
│ /dev/shm       │ 991.6M │     0B │ 991.6M │        │ tmpfs    │ tmpfs      │
│ /run           │ 198.3M │ 952.0K │ 197.4M │   0.5% │ tmpfs    │ tmpfs      │
│ /run/lock      │   5.0M │     0B │   5.0M │        │ tmpfs    │ tmpfs      │
│ /run/snapd/ns  │ 198.3M │ 956.0K │ 197.4M │   0.5% │ tmpfs    │ tmpfs      │
│ /run/user/0    │ 198.3M │     0B │ 198.3M │        │ tmpfs    │ tmpfs      │
│ /sys/fs/cgroup │ 991.6M │     0B │ 991.6M │        │ tmpfs    │ tmpfs      │
╰────────────────┴────────┴────────┴────────┴────────┴──────────┴────────────╯

Next, Find out more duf usages and available options that you can use to get started,

duf --help

To display the information about Pseudo, inaccessible, and duplicate file systems, run the following command:

duf -all

Output:

root@vps:~# duf -all
╭────────────────────────────────────────────────────────────────────────────╮
│ 6 local devices                                                            │
├───────────────────┬───────┬───────┬───────┬────────┬──────────┬────────────┤
│ MOUNTED ON        │  SIZE │  USED │ AVAIL │  USE%  │ TYPE     │ FILESYSTEM │
├───────────────────┼───────┼───────┼───────┼────────┼──────────┼────────────┤
│ /                 │ 48.7G │  2.5G │ 43.7G │   5.0% │ ext4     │ /dev/vda3  │
│ /snap/core18/2128 │ 55.5M │ 55.5M │    0B │ 100.0% │ squashfs │ /dev/loop0 │
│ /snap/core20/1518 │ 62.0M │ 62.0M │    0B │ 100.0% │ squashfs │ /dev/loop4 │
│ /snap/lxd/21029   │ 70.4M │ 70.4M │    0B │ 100.0% │ squashfs │ /dev/loop1 │
│ /snap/lxd/22753   │ 67.9M │ 67.9M │    0B │ 100.0% │ squashfs │ /dev/loop5 │
│ /snap/snapd/16292 │ 47.0M │ 47.0M │    0B │ 100.0% │ squashfs │ /dev/loop3 │
╰───────────────────┴───────┴───────┴───────┴────────┴──────────┴────────────╯
╭──────────────────────────────────────────────────────────────────────────────────╮
│ 35 special devices                                                               │
├────────────────────┬────────┬────────┬────────┬────────┬───────────┬─────────────┤
│ MOUNTED ON         │   SIZE │   USED │  AVAIL │  USE%  │ TYPE      │ FILESYSTEM  │
├────────────────────┼────────┼────────┼────────┼────────┼───────────┼─────────────┤
│ /dev               │ 947.7M │     0B │ 947.7M │        │ devtmpfs  │ udev        │
│ /dev/hugepages     │     0B │     0B │     0B │        │ hugetlbfs │ hugetlbfs   │
│ /dev/mqueue        │     0B │     0B │     0B │        │ mqueue    │ mqueue      │
│ /dev/pts           │     0B │     0B │     0B │        │ devpts    │ devpts      │
│ /dev/shm           │ 991.6M │     0B │ 991.6M │        │ tmpfs     │ tmpfs       │
│ /proc              │     0B │     0B │     0B │        │ proc      │ proc        │
│ /proc/sys/fs/binfm │     0B │     0B │     0B │        │ binfmt_mi │ binfmt_misc │
│ t_misc             │        │        │        │        │ sc        │             │
│ /proc/sys/fs/binfm │     0B │     0B │     0B │        │ autofs    │ systemd-1   │
│ t_misc             │        │        │        │        │           │             │
│ /run               │ 198.3M │ 952.0K │ 197.4M │   0.5% │ tmpfs     │ tmpfs       │
│ /run/lock          │   5.0M │     0B │   5.0M │        │ tmpfs     │ tmpfs       │
│ /run/snapd/ns      │ 198.3M │ 952.0K │ 197.4M │   0.5% │ tmpfs     │ tmpfs       │
│ /run/snapd/ns/lxd. │     0B │     0B │     0B │        │ nsfs      │ nsfs        │
│ mnt                │        │        │        │        │           │             │
│ /run/user/0        │ 198.3M │     0B │ 198.3M │        │ tmpfs     │ tmpfs       │
│ /sys               │     0B │     0B │     0B │        │ sysfs     │ sysfs       │
│ /sys/fs/bpf        │     0B │     0B │     0B │        │ bpf       │ none        │
│ /sys/fs/cgroup     │ 991.6M │     0B │ 991.6M │        │ tmpfs     │ tmpfs       │
│ /sys/fs/cgroup/blk │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ io                 │        │        │        │        │           │             │
│ /sys/fs/cgroup/cpu │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ ,cpuacct           │        │        │        │        │           │             │
│ /sys/fs/cgroup/cpu │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ set                │        │        │        │        │           │             │
│ /sys/fs/cgroup/dev │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ ices               │        │        │        │        │           │             │
│ /sys/fs/cgroup/fre │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ ezer               │        │        │        │        │           │             │
│ /sys/fs/cgroup/hug │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ etlb               │        │        │        │        │           │             │
│ /sys/fs/cgroup/mem │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ ory                │        │        │        │        │           │             │
│ /sys/fs/cgroup/net │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ _cls,net_prio      │        │        │        │        │           │             │
│ /sys/fs/cgroup/per │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ f_event            │        │        │        │        │           │             │
│ /sys/fs/cgroup/pid │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ s                  │        │        │        │        │           │             │
│ /sys/fs/cgroup/rdm │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ a                  │        │        │        │        │           │             │
│ /sys/fs/cgroup/sys │     0B │     0B │     0B │        │ cgroup    │ cgroup      │
│ temd               │        │        │        │        │           │             │
│ /sys/fs/cgroup/uni │     0B │     0B │     0B │        │ cgroup2   │ cgroup2     │
│ fied               │        │        │        │        │           │             │
│ /sys/fs/fuse/conne │     0B │     0B │     0B │        │ fusectl   │ fusectl     │
│ ctions             │        │        │        │        │           │             │
│ /sys/fs/pstore     │     0B │     0B │     0B │        │ pstore    │ pstore      │
│ /sys/kernel/config │     0B │     0B │     0B │        │ configfs  │ configfs    │
│ /sys/kernel/debug  │     0B │     0B │     0B │        │ debugfs   │ debugfs     │
│ /sys/kernel/securi │     0B │     0B │     0B │        │ securityf │ securityfs  │
│ ty                 │        │        │        │        │ s         │             │
│ /sys/kernel/tracin │     0B │     0B │     0B │        │ tracefs   │ tracefs     │
│ g                  │        │        │        │        │           │             │
╰────────────────────┴────────┴────────┴────────┴────────┴───────────┴─────────────╯

Done!