Skip to content
Related Articles

Related Articles

Improve Article

Gdu – Faster Disk Usage Analyzer for Linux

  • Last Updated : 06 Jun, 2021

GDU is a disk usage analyzer written in Go language for the Linux Operating systems. Gdu was actually made for SSD disks where it can totally utilize parallel processing. Although it works for HDDs too, but the performance gain is not so good.GDU can run in two modes one is interactive and another is non-interactive. It is a good tool to analyze disk but it has many alternatives like the ncdu, godu, du, duc. Now let’s see how to install the GDU on a Linux system.

Installation

GDU provides multiple ways to install the GDU on your system according to your Linux distro, you can check all methods from their GitHub repository. But for now, let’s see the common method to install the GDU using the curl command.

Use the following commands to install  GDU 

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

chmod +x gdu_linux_amd64



mv gdu_linux_amd64 /usr/bin/gdu

Now we have installed the GDU on our Linux system. You can verify the installation of GDU using the following command:

 gdu --version

Then you will see the installed version of the GDU

Now let’s see how to analyze the disk using the GDU

Analyzing directory disk usage using GDU

To analyze the current working directory just run the gdu command on the terminal. Then it will show the disk usage by files in the current directory. Now I am in the /home/nishant/codes/bash directory.

gdu

Then you will see output like the:



To analyze the specific directory you can mention the path of the directory after the gdu command like this:-

gdu   /lib/apt/

Then you will see the output:-

Note that we can provide only one argument to the gdu. Now let’s see options to use interactive mode.

Options for interactive mode

GDU provides the options to use GDU more effectively in interactive mode. To see all options press Key on the keyboard. Now we can see the options using which we can move the cursor up/down, select and delete directories or files using keys like J , G , l , h , etc .

We can delete the selected file by pressing the d key on the keyboard

You can also view the content of a file by pressing the v key on the keyboard



Flags in GDU

  Did you observe the flags like e , ! , . , @, H,e before the file names ? Each of the flags has a different meaning, let us see the meaning of each flag

!   -> An Error appeared while reading directory 
.   -> An Error appeared while reading subdirectory.
@   -> File is a socket or simlink.
H   -> Hardlink(File) which was already counted.
e   -> An Empty directory.

Other options of GDU

 Now let’s see some other options provided by GDU. We can see all option provided by the GDU using the help command as follows:

gdu --help

Now let’s see how to use these options

-c options 

              By using this option we can print the output in black and white color.

gdu -c directory_path

-n options

If you want the outputs in the non-interactive form then you can use the flag “n”  

gdu -n directory_path

My Personal Notes arrow_drop_up
Recommended Articles
Page :