Install and Use Duf Disk Monitoring Tool on Ubuntu 20.04
On this page
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 20.04.
Prerequisites
- A server running Ubuntu 20.04.
- A root password is configured on the server.
Getting Started
First, it is always recommended to update your package cache with the latest version. You can do it with the following command:
apt-get update -y
Once you are done, you can proceed to the next step.
Install Duf
By default, the Duf package is not available in the Ubuntu default repository so you will need to download it from their download page.
You can download it with the following command:
wget https://github.com/muesli/duf/releases/download/v0.6.2/duf_0.6.2_linux_amd64.deb
Once the download is completed, install the downloaded file with the following command:
dpkg -i duf_0.6.2_linux_amd64.deb
How to Use Duf
In this section, we will show you how to monitor disk usage using the Duf utility.
Run the Duf command utility without any option will list all the logical partitions and filesystems:
duf
You should see the following output:
????????????????????????????????????????????????????????????????????????????????????????? ? 1 local device ? ????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ????????????????????????????????????????????????????????????????????????????????????????? ? / ? 49.2G ? 3.2G ? 43.8G ? [#...................] 6.5% ? ext4 ? /dev/sda1 ? ????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????? ? 6 special devices ? ????????????????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ????????????????????????????????????????????????????????????????????????????????????????????????????? ? /dev ? 980.7M ? 0B ? 980.7M ? ? devtmpfs ? udev ? ? /dev/shm ? 993.9M ? 0B ? 993.9M ? ? tmpfs ? tmpfs ? ? /run ? 198.8M ? 600.0K ? 198.2M ? [....................] 0.3% ? tmpfs ? tmpfs ? ? /run/lock ? 5.0M ? 0B ? 5.0M ? ? tmpfs ? tmpfs ? ? /run/user/0 ? 198.8M ? 0B ? 198.8M ? ? tmpfs ? tmpfs ? ? /sys/fs/cgroup ? 993.9M ? 0B ? 993.9M ? ? tmpfs ? tmpfs ? ?????????????????????????????????????????????????????????????????????????????????????????????????????
To display the disk usage information of the directory /etc and /usr, run the following command:
duf /etc /usr
You should see the following output:
????????????????????????????????????????????????????????????????????????????????????????? ? 2 local devices ? ????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ????????????????????????????????????????????????????????????????????????????????????????? ? / ? 49.2G ? 3.2G ? 43.8G ? [#...................] 6.5% ? ext4 ? /dev/sda1 ? ? / ? 49.2G ? 3.2G ? 43.8G ? [#...................] 6.5% ? ext4 ? /dev/sda1 ? ?????????????????????????????????????????????????????????????????????????????????????????
To display the information about Pseudo, inaccessible, and duplicate file systems, run the following command:
duf -all
You should see the following output:
????????????????????????????????????????????????????????????????????????????????????????? ? 1 local device ? ????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ????????????????????????????????????????????????????????????????????????????????????????? ? / ? 49.2G ? 3.2G ? 43.8G ? [#...................] 6.5% ? ext4 ? /dev/sda1 ? ????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ? 33 special devices ? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ? /dev ? 980.7M ? 0B ? 980.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 ? 993.9M ? 0B ? 993.9M ? ? tmpfs ? tmpfs ? ? /proc ? 0B ? 0B ? 0B ? ? proc ? proc ? ? /proc/sys/fs/binfmt_misc ? 0B ? 0B ? 0B ? ? autofs ? systemd-1 ? ? /proc/sys/fs/binfmt_misc ? 0B ? 0B ? 0B ? ? binfmt_misc ? binfmt_misc ? ? /run ? 198.8M ? 600.0K ? 198.2M ? [....................] 0.3% ? tmpfs ? tmpfs ? ? /run/lock ? 5.0M ? 0B ? 5.0M ? ? tmpfs ? tmpfs ? ? /run/user/0 ? 198.8M ? 0B ? 198.8M ? ? tmpfs ? tmpfs ? ? /sys ? 0B ? 0B ? 0B ? ? sysfs ? sysfs ? ? /sys/fs/bpf ? 0B ? 0B ? 0B ? ? bpf ? none ? ? /sys/fs/cgroup ? 993.9M ? 0B ? 993.9M ? ? tmpfs ? tmpfs ? ? /sys/fs/cgroup/blkio ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/cpu,cpuacct ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/cpuset ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/devices ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/freezer ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/hugetlb ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/memory ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/net_cls,net_p ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? rio ? ? ? ? ? ? ? ? /sys/fs/cgroup/perf_event ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/pids ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/rdma ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/systemd ? 0B ? 0B ? 0B ? ? cgroup ? cgroup ? ? /sys/fs/cgroup/unified ? 0B ? 0B ? 0B ? ? cgroup2 ? cgroup2 ? ? /sys/fs/fuse/connections ? 0B ? 0B ? 0B ? ? fusectl ? fusectl ? ? /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/security ? 0B ? 0B ? 0B ? ? securityfs ? securityfs ? ? /sys/kernel/tracing ? 0B ? 0B ? 0B ? ? tracefs ? tracefs ? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
To display the Inode usage, run the following command:
duf --inodes
You should see the following output:
??????????????????????????????????????????????????????????????????????????????????????????????? ? 1 local device ? ??????????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? INODES ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ??????????????????????????????????????????????????????????????????????????????????????????????? ? / ? 3276800 ? 150623 ? 3126177 ? [....................] 4.6% ? ext4 ? /dev/sda1 ? ??????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????? ? 6 special devices ? ??????????????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? INODES ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ??????????????????????????????????????????????????????????????????????????????????????????????????? ? /dev ? 251048 ? 390 ? 250658 ? [....................] 0.2% ? devtmpfs ? udev ? ? /dev/shm ? 254428 ? 1 ? 254427 ? [....................] 0.0% ? tmpfs ? tmpfs ? ? /run ? 254428 ? 517 ? 253911 ? [....................] 0.2% ? tmpfs ? tmpfs ? ? /run/lock ? 254428 ? 4 ? 254424 ? [....................] 0.0% ? tmpfs ? tmpfs ? ? /run/user/0 ? 254428 ? 12 ? 254416 ? [....................] 0.0% ? tmpfs ? tmpfs ? ? /sys/fs/cgroup ? 254428 ? 18 ? 254410 ? [....................] 0.0% ? tmpfs ? tmpfs ? ???????????????????????????????????????????????????????????????????????????????????????????????????
To sort the disk usage, run the following command:
duf --sort size
Output:
????????????????????????????????????????????????????????????????????????????????????????? ? 1 local device ? ????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ????????????????????????????????????????????????????????????????????????????????????????? ? / ? 49.2G ? 3.2G ? 43.8G ? [#...................] 6.5% ? ext4 ? /dev/sda1 ? ????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????? ? 6 special devices ? ????????????????????????????????????????????????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? USE% ? TYPE ? FILESYSTEM ? ????????????????????????????????????????????????????????????????????????????????????????????????????? ? /run/lock ? 5.0M ? 0B ? 5.0M ? ? tmpfs ? tmpfs ? ? /run/user/0 ? 198.8M ? 0B ? 198.8M ? ? tmpfs ? tmpfs ? ? /run ? 198.8M ? 600.0K ? 198.2M ? [....................] 0.3% ? tmpfs ? tmpfs ? ? /dev ? 980.7M ? 0B ? 980.7M ? ? devtmpfs ? udev ? ? /dev/shm ? 993.9M ? 0B ? 993.9M ? ? tmpfs ? tmpfs ? ? /sys/fs/cgroup ? 993.9M ? 0B ? 993.9M ? ? tmpfs ? tmpfs
To display only certain columns, run the following command:
duf --output mountpoint,size,used,avail,filesystem
Output:
?????????????????????????????????????????????????? ? 1 local device ? ?????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? FILESYSTEM ? ?????????????????????????????????????????????????? ? / ? 49.2G ? 3.2G ? 43.8G ? /dev/sda1 ? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????????????? ? 6 special devices ? ?????????????????????????????????????????????????????????? ? MOUNTED ON ? SIZE ? USED ? AVAIL ? FILESYSTEM ? ?????????????????????????????????????????????????????????? ? /dev ? 980.7M ? 0B ? 980.7M ? udev ? ? /dev/shm ? 993.9M ? 0B ? 993.9M ? tmpfs ? ? /run ? 198.8M ? 600.0K ? 198.2M ? tmpfs ? ? /run/lock ? 5.0M ? 0B ? 5.0M ? tmpfs ? ? /run/user/0 ? 198.8M ? 0B ? 198.8M ? tmpfs ? ? /sys/fs/cgroup ? 993.9M ? 0B ? 993.9M ? tmpfs ? ??????????????????????????????????????????????????????????
To print all option available in Duf, run the following command:
duf --help
Output:
Usage of duf: -all include pseudo, duplicate, inaccessible file systems -hide string hide specific devices, separated with commas: local, network, fuse, special, loops, binds -hide-fs string hide specific filesystems, separated with commas -inodes list inode information instead of block usage -json output all devices in JSON format -only string show only specific devices, separated with commas: local, network, fuse, special, loops, binds -only-fs string only specific filesystems, separated with commas -output string output fields: mountpoint, size, used, avail, usage, inodes, inodes_used, inodes_avail, inodes_usage, type, filesystem -sort string sort output by: mountpoint, size, used, avail, usage, inodes, inodes_used, inodes_avail, inodes_usage, type, filesystem (default "mountpoint") -style string style: unicode, ascii (default "unicode") -theme string color themes: dark, light (default "dark") -version display version -warnings output all warnings to STDERR -width uint max output width
Conclusion
In the above guide, you learned how to monitor disk usage with Duf in Ubuntu 20.04. I hope this tool will help you to monitor the disk usage of your system in a beautiful and user-friendly layout.