Gdu – A Pretty Fast Disk Usage Analyzer for Linux

In this article, we will take a look at gdu an open-source disk usage analyzer written in go. Gdu is inspired by godu, dua, ncdu, and df.

The gdu tool is created for SSD drives where parallel processing can be utilized. This tool can also work with HDD with less performance compared to SSD drives. You can also check benchmark results. There are many other similar tools and you have to play with gdu first to see if satisfy your needs.

How to Install Gdu – Linux Disk Usage Analyzer

There are few different ways to install gdu in different Linux flavors but I am going to stick with a common way that can be followed irrespective of what distribution you are running with.

Go to the gdu GitHub release page to download the archive file. The latest version is V4.9.1 and I suggest downloading the latest version.

$ curl -L https://github.com/dundee/gdu/releases/latest/download/gdu_linux_amd64.tgz | tar xz
$ chmod +x gdu_linux_amd64
$ sudo mv gdu_linux_amd64 /usr/bin/gdu

Now you can verify the installation by running the following command.

$ gdu --version

Version:        v4.9.1
Built time:     Sat Mar 27 09:47:28 PM  CET 2021
Built user:     dundee

A good practice before playing with any new tools is to check the help options.

$ gdu --help
Gdu Help Options
Gdu Help Options

If you run the gdu command without passing any argument it will scan your current working directory. I am in my home directory now and when I run gdu, you can see from the below image my home directory is scanned.

$ gdu
Check Disk Usage of Home Directroy
Check Disk Usage of Home Directroy

To scan for any particular directories you have to pass the directory name as an argument.

$ gdu /home/tecmint/bash
Check Disk Usage of Directroy
Check Disk Usage of Directroy

You cannot pass more than one argument.

$ gdu /home /var

There are few operations you can perform with the gdu command. Press ? to access help.

Gdu Help and Usage
Gdu Help and Usage

From the help you can see, there are options to sort, scan and move across directories. Access help and try exploring all the options to get comfortable.

You can delete a file or directory by pressing the “d" key. It will prompt you for confirmation.

Delete File or Directory
Delete File or Directory

You can also view the content of any file by pressing the “v" key. To come out of the file press the escape key.

View File Content
View File Content

You can ignore certain directories from the output by adding directory names as an argument to the -i flag. Multiple directories can also be passed to the -i flag and each directory should be separated by commas.

$ gdu /home/karthick/ -i /home/karthick/.ssh,/home/karthick/sqlite

You may see special characters in the files and directories and each has a special meaning. From the below example you can see the “/network” directory is empty so the character “e” is prefixed to denote that.

[ ! ] ⇒ Error while reading directory
[ . ] ⇒ Error while reading subdirectory.
[ @ ] ⇒ File is socket or simlink.
[ H ] ⇒ Hardlink which is already counted.
[ e ] ⇒ Empty directory.
Special Characters Files
Special Characters Files

If you like black and white output, you can use “-c" flag. See the below image where the output is printed in black and white.

$ gdu -c /etc/systemd
Black and White Output
Black and White Output

All the commands till now will launch an interactive mode to show disk stats. If you want the output in non-interactive mode use the “-n" flag.

$ gdu -n ~
Non Interactive Output
Non Interactive Output

That’s it for this article. Play with gdu and let us know how it suits your needs compared to other disk usage tools.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Karthick
A passionate software engineer who loves to explore new technologies. He is a public speaker and loves writing about technology, especially about Linux and open source.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

5 Comments

Leave a Reply
  1. On Debian 10, I’m using ncdu which offers quite the same features. ncdu is in the repo

    Screenshots: https://screenshots.debian.net/package/ncdu#gallery-1

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.