How to Check Disk Usage on Linux With duf

How to Check Disk Usage on Linux With duf

Linux has a bunch of useful commands to simplify certain operations on the system. df, for instance, helps you determine how much free disk space you have on a drive, whereas du shows the estimated file space usage on your system.

While both these commands work well and do their job as intended, there’s another useful command called duf, an alternative to df that provides better disk monitoring functionality.

In this guide, we’ll look at duf in detail and go over the steps to install and use it on Linux.

What Is duf?

duf or Disk Usage/Free is a free and open-source command-line utility that allows you to view your system’s disk usage and free space from right inside a terminal window.

It essentially combines the functionality of both du and df into a single command, so you don’t have to run the two commands individually. Not just that, with duf, you also get the information in a modern and comprehensible manner, which makes it more user-friendly for those who are just getting started with Linux.

Related: How to Show Disk Usage in Linux With the du Command

Why Use duf?

One of the biggest advantages of duf over df is its comprehensive feature set; one that gives you the freedom to filter, sort, and export results to JSON, among other things.

Here’s a list of all the highlighting features of duf:

  • Colorful and easy-to-comprehend output
  • Freedom to adjust terminal’s theme
  • Ability to sort or filter results to your preference
  • Option to export output in JSON


How to Install duf on Linux

Depending on what Linux distro you’re running on your computer, you can install duf on it in a few different ways.

1. Install duf Using a DEB or RPM Package

Installing duf using a DEB or RPM package is very easy, thanks to the official package files provided by the developers.

For this method, first, head over to duf’s GitHub Releases page. Then, click on the file that ends with the .deb extension if you’re on Debian or its derivates, or with the .rpm extension if you’re running RHEL or any of its derivatives like Fedora, CentOS, etc.

Download: duf Package

If you don’t want to download the package from the Releases page, you can also use wget to get the package right inside the terminal.

For this, check whether wget is present on your system by running:

wget --version

If it isn’t, download it first.

Now, if you’re on a Debian-based distro, run the command below to get duf:


On RHEL-based distros, run:


Now, you have two options to install the package. You can either use the GUI version of your system’s package installer or install it from the command line.

If you prefer the GUI approach, go to the Downloads directory, right-click on the package file, and select Open With GDebi Package Installer or Open With Software Installer, based on your Linux distro. Once it opens the installer, click on the Install Package or Install button to begin the installation.

Alternatively, to use the CLI method, open the terminal and navigate to the Downloads directory using the cd command. Then, depending on your Linux distro, enter the appropriate command to install the package on your system.

On Debian-based distros:

sudo dpkg -i duf_0.x.x_linux_amd64.deb

On RHEL-based distros:

sudo rpm -i duf_0.x.x_linux_amd64.rpm

Arch users can install duf from the AUR using an AUR helper like Yay:

yay -S duf

2. Install duf Using Snap

You can also install duf on your system using its official snap package. For this, make sure you have Snap installed on your computer by running the following command:

snap --version

If this returns a version number, it means Snap is present on the system, and you can proceed to the next step. However, in case it doesn’t, you’ll need to install Snap first.

Considering you’ve done that part, you can install duf via Snap by running:

sudo snap install duf-utility

3. Build duf From Source

While both the package manager and Snap methods work well, if you’d like to build the program from the source, duf offers the freedom to do so. However, since duf is written in Go, make sure you have a working Go environment on your computer.

Once done, you can compile duf by running the following set of commands:

git clone
cd duf
go build

Related: How to Compile and Install Software From Source in Linux

How to Use duf to Check Disk Usage

With duf installed, you can start using it right away. To do this, open a terminal and run:


This will return a list of all the devices and mount points on your system, as shown below.

duf command output

However, if you want to list only specific devices and mount points, you can narrow down the result using commands in the following format:

duf /
duf /home

Moreover, in case you need to display all file systems, including pseudo, duplicate, and inaccessible file systems, you may do so with:

duf --all

Filtering Results

While the output displayed in a tabular form is pretty easy to understand, filtering it to show or hide specific tables makes it easier to view information only about the tables you need to know about.

As such, duf offers two options for filtering devices: –only and –hide, and here’s how they can come in handy.

Let’s say you want to view devices listed only in two specific tables: local and network. In this situation, instead of running the plain duf command, you can modify it to include only two tables. Like this:

duf --only local,network

duf filter results

Similarly, if you want to hide these tables from the results, you can do so with:

duf --hide local,network

duf’s filtering also works with file systems and mount points, so you can show or hide file systems and mount points as well.

To show specific file systems:

duf --only-fs tmps,vfat

When you want to hide particular file systems:

duf --hide-fs tmpfs,vfat

For showing mount points:

duf --only-mp /,/home

To hide these mount points from the result:

duf --hide-mp /,/home

Sorting Results

Much like filtering out the results to view information about selected devices and mount points, you can also sort the order in which the table data is listed.

For example, if you want to sort the SIZE column in the table, the following command can do that for you:

duf --sort size

duf sort result by size

Similarly, you can also show or hide specific columns in a table. So let’s say you want to show only the SIZE and AVAIL columns in the result. You can do this with:

duf --output size,avail

Viewing inode Information

All Unix and Unix-like systems use both blocks and inodes to organize and store data. While blocks represent data, inodes represent files.

With duf, you can view both block and inode, although the default representation is set to show block data. To view inode information instead of block usage, simply run:

duf --inodes

Exporting Results in JSON

If you ever need to export results, duf gives you the option to export them in JSON file format. This makes the exported file more accessible and readable across different apps and devices.

Just open a terminal and run the following command to export your duf result in JSON:

duf --json

export duf result in JSON

Setting a Terminal Theme

Although duf automatically detects your terminal’s color scheme correctly, in case it fails to do so, you can change the theme using the –theme argument, as shown below:

duf --theme light


duf --theme dark

Getting Command-Line Help

At any point, if you run into problems with the syntax of a command, you can seek help using:

duf --help

duf help

Disk Usage Monitoring on Linux Simplified

Monitoring disk usage on Linux is easier than ever, thanks to the duf command. While other CLI tools like du and df are there, too, and they get the job done, but duf’s ease of use and comprehensible data representation simplifies the process significantly.

Not to mention, it gives you more functionality and control over the output, so you don’t get overwhelmed by too much information.

If you’re just getting started with Linux, you may benefit from learning about mounting the hard drive using the command line.

How to Mount a Hard Drive in Linux Using the Command Line

Need to mount a hard drive or disk partition on Linux? Here’s what you need to know about the udisks and mount commands.

Read Next

About The Author

Original Link

Leave a Comment

Your email address will not be published.