Jump to content

Duf - Check Disk Usage on Linux


aum

Recommended Posts

duf-check-disk-usage-linux.png

 

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:

 

  • Intuitive and neat colorful output

 

  • Ability to provide output in JSON format.

 

  • Provides responsive output that fits neatly on your terminal.

 

  • Grouping and filtering devices.

 

  • 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-using-snap-packages.png

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-amd64-deb-package.png

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.png

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.png

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-root-filesystem.png

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.png

duf sort columns to be displayed

 

You can display inodes as follows:

 

$ duf --inodes

 

Print-inode-number.png

duf display inode number

 

To print the output in JSON, execute:

 

$ duf --json

 

duf-json-format.png

duf json output

 

For more command options run the command:

 

$ duf --help

 

Conclusion


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.

 

Source

 

Link to comment
Share on other sites


  • Views 1.1k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...