Use gdu for a Faster Disk Usage Checking in Linux Terminal

The gdu command gives a more streamlined way of checking the directory sizes and disk usage analysis. Works faster on SSDs.
Warp Terminal

There are two popular ways to check disk usage in Linux terminal: du command and df command.

The du command is more for checking the space used by a directory and the df command gives you the disk utilization on filesystem level.

The gdu tool sorts of combined the functionality of both.

You can use it to check the size of directories as well as disk utilization. The built in sorting feature makes it easier to use as you don't need to combine the sort command here.

Gdu: Disk usage checking in Linux terminal

Gdu is a tool written in Go (hence the β€˜g’ in gdu). Gdu developer has benchmark tests to show that it is quite fast for disk usage checking, specifically on SSDs. In fact, gdu is intended primarily for SSDs though it can work for HDD as well.

If you use the gdu command without any options, it shows the disk usage for the current directory you are in.

Running the default Gdu in Linux terminal without any options. Use the arrow keys for navigation.
Running Gdu

Since it has a terminal user interface (TUI), you can navigate through directories and disk using arrows. You can also sort the result by file names or size.

Here’s how to do that:

  • Use the Up arrow or k to move the cursor up. Similarly, use the down arrow or j to move the cursor down
  • Enter to select directory / device
  • Left arrow or h to go to parent directory
Navigate inside the Gddu using Arrow keys or H, J, K keys
Gdu Navigation
  • Use d to delete the selected file or directory
Use the Gdu interactive mode to delete files
Delete Files with Gdu
  • Use n to sort by name and use s to sort by size.
Sort entriees by name or size using the N and S keys respectively in gdu interactive mode.
Sort Entries
  • Use c to sort by items

You’ll notice some symbols before some file entries. Those have specific meaning.

Gdu entry symbols
Gdu Symbols
  • ! means an error occurred while reading the directory.
  • . means an error occurred while reading a subdirectory, size may not be correct.
  • @ means file is a symlink or socket.
  • H means the file was already counted (hard link).
  • e means directory is empty.

To see the disk utilization and free space for all mounted disks, use the option d:

gdu -d

It shows all the details in one screen:

Show all mounted disk using Gddu.
Gdu list mounted

Sounds like a handy tool, right?

More Gdu options for Disk Usage Analysis

Here are some more options, that you can use with Gdu.

Command Usage
gdu -H Ignore Hidden Directories
gdu -i /sys,/proc / Ignore the specified directories and do gdu on root dorectory
gdu -d Show all mounted disks
gdu -n Run in a non-interactive mode

Installing gdu on Linux

Interested in trying gdu. Here are a few ways of installing it.

From Official Repositories

Gdu is available in the repositories of Ubuntu, Debian, Arch Linux etc. In Debian/Ubuntu, you can install it using the apt command.

So, open a terminal and run:

sudo apt update
sudo apt install gdu

If you are an Arch Linux user, you can install it using the pacman command.

sudo pacman -Syu gdu

Alternatively, install gdu using the official binary

Gdu provides a binary, which you can download and use. First, make sure you have curl installed.

sudo apt install curl

Then, download the file and extract it using the commands below:

curl -L https://github.com/dundee/gdu/releases/latest/download/gdu_linux_amd64.tgz | tar xz

Now, give it execution permission and move the binary file somewhere that is in the path. You can do it by:

chmod +x gdu_linux_amd64
mv gdu_linux_amd64 /usr/bin/gdu

Wrapping Up

There are more friendly ways to see the disk usage in Linux with graphical tools like GNOME Disks. If you are confined to the terminal, you can use a TUI tool like ncdu to get the disk usage information with a sort of graphical touch. Gdu is one such entry to this list.

Gdu is a neat tool, that does not come with overwhelming options. It provides some necessary functions with speed in mind. It's something you can add to your toolbox.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries πŸ•΅οΈβ€β™‚οΈ

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.