Check Your Disk Usage Using ‘duf’ Terminal Tool [Friendly Alternative to du and df commands]

Brief: duf is a terminal tool meant as an enhancement to the traditional “df” and “du” Linux commands. It lets you easily check for free disk space, sort the output, and present it in a user-friendly manner.

duf: A Cross-Platform disk usage utility written in Golang

duf utility to analyze disk space

Before I knew about this utility, I preferred using a GUI program like Stacer or the pre-installed GNOME Disk usage app to check free disk space and the disk usage numbers for my system.

However, duf seems to be a useful terminal tool to check disk usage and free space that is written in Golang. Even though Abhishek suggested me to give this a try, I found it more interesting, especially considering that I’m currently learning Golang, what a coincidence!

It is fairly easy to use no matter whether you are a terminal guru or just a beginner not comfortable with the terminal. It is certainly easier to understand than the df command for checking disk space utilization.

Let me highlight some of the key features and its usage before you get it installed on your system.

Features of duf

duf local
  • Gives you an overview of all the devices mounted which is easy to understand
  • Ability to specify a directory/file name and check free space for that mount point
  • Change/Remove columns from the output
  • List inode information
  • Sort the output
  • JSON output supported
  • Ability to specify the theme if it does not detect your terminal’s theme automatically

Installing & Using duf on Linux

You can find a package for Arch Linux in AUR. There’s also a package available if you’re using the Nix package manager.

For Debian-based distros and RPM packages, you can go to its GitHub releases section and grab the package suitable for your system.

It’s also available for Windows, Android, macOS, and FreeBSD as well.

In my case, I had to install the DEB package, and it was good to go. Once you set it up, using it is quite simple, all you have to do is type in:

duf

This should give you the details for all the local devices, any cloud storage devices mounted, and any other special devices (that includes temporary storage locations and more).

If you want to take a look at all the available commands using duf at a glance, you can type in:

duf --help
duf command option

For instance, if you just want to see the details of the local devices connected and nothing else, all you have to type is:

duf --only local

Another example would be sorting the output based on the size in a particular order, here’s what you need to type:

duf --sort size

And, the output should look like:

duf sort example

You can explore its GitHub page for more information on additional commands and installation instructions.

Closing Thoughts

I find the terminal tool ‘duf’ quite handy to keep an eye on the free disk space or the usage stats without needing to use a GUI program.

Is there anything similar to this tool that you know of? Feel free to let me know your thoughts in the comments down below.

Default image
Contributor
Articles: 318