On Linux, several utilities are available to check disk usage and storage including df, ncdu, and gdu. Read on to learn how you can use gdu to analyze disk usage on your Linux system, along with a brief guide on how to install it.

What Is the gdu Utility?

As mentioned above, gdu is a disk usage analyzer written in the Go programming language. Gdu stands for Go Disk Usage. While there are other tools available that perform the same task, gdu is a fast, reliable, and easy to use utility.

The only thing that makes gdu stand out of the crowd is its speed. It leverages the power of parallel processing to enhance the scanning rate of the drives. Although gdu’s performance is average while analyzing HDDs, its true power is unleashed when you work with SSDs.

The table below describes the performance rate of gdu while scanning 80GB of data on a 500GB SSD. Notice that gdu has the highest scan speed when compared with other disk usage analyzers.

Download and Install gdu on Linux

Since gdu is not available on Linux distributions by default, you’ll have to install the package manually.

You can download gdu from its Github repository using curl.

Change the permissions of gdu_linux_amd64 with the chmod command to make it an executable file.

Move the file to the /usr/bin directory.

Type gdu –version in the terminal to check whether the package was installed successfully. You will see an output that looks something like this.

How to Use the gdu Command

If you run the command with no arguments, gdu will scan the current directory and display storage-related information.

To scan a particular directory, you can specify the name of the folder with the default command. To analyze the disk usage for /Desktop:

Note: Unlike the ls command in Linux, you can’t specify multiple directories with gdu. The system will display an error stating “Error: accepts at most 1 arg(s), received 2”.

Ignore Directories From the Output

If you want to ignore specific sub-directories while scanning for the parent directory, use the -i flag. The -i stands for Ignore and will discard any directory that follows the flag.

The aforementioned command will analyze the /Desktop directory and will not show the /Desktop/Ignore sub-directory in the output. You can also pass multiple directories in the -i flag by separating them with the comma (,) character.

Gdu Functions and Options

Press the Question Mark (?) key to get a list of available operations.

To delete a directory or a file, highlight the entry and press D.

You can also view the content of any file with gdu. Simply highlight the file and hit the V key.

To get the output in black and white, use the -c flag with the command.

Gdu can also scan mounted disks on your Linux system. Use the -d flag with the command to display information related to mounted disks.

To prevent gdu from launching in interactive mode, use the -n flag.

Gdu Special Entry Identifiers

Notice in the output above, gdu displays a special character before the entries. Each character has a specific meaning that denotes the filetype.

Gdu uses the following characters in the output:

Monitoring Disk Space With gdu

While working on a Linux machine, it is important to do a regular audit of your system’s health, storage, applications, etc. Doing so will ensure that your computer can provide the best performance to you for a long time.

Storage is an essential component of a computer. With so much data readily available on the internet, carefully utilizing your disk space becomes a must. If you don’t have enough space on your device, you can always opt for cloud storage platforms to store your files.