How To Analyze Disk Usage on Linux using gdu

In this article, we are looking at how to analyze disk usage in Linux using gdu. Gdu is a high speed console disk usage analyzer written in Go language and primarily meant for Solid State Drives (SSD) where it can make use of parallel processing. It can still work with HDDs but with compromised performance. Below is how gdu interface looks like. You can use ‘arrow keys’ to navigate through the available directories and ‘Enter’ to select. Gdu works just like ncdu but with a big difference in operating speeds.

Installing GDU on Linux

There are different ways of installing gdu on Linux as discussed below:

Install gdu from binaries

With curl, we are going to download gdu binaries to our Linux system, make them executable and copy to the right path. Run the commands below. I am running these commands on Debian/ Ubuntu. Other binaries are available in gdu github releases page.

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

Once done, you can simply run gdu on your terminal. You should get an output similar to the below:

Installing gdu Using Snap

You can simply install gdu using snap by running the below commands:

snap install gdu-disk-usage-analyzer
snap connect gdu-disk-usage-analyzer:mount-observe :mount-observe
snap connect gdu-disk-usage-analyzer:system-backup :system-backup
snap alias gdu-disk-usage-analyzer.gdu gdu

Install gdu from package managers

Gdu is available on AUR and Brew and you can install as below:

# Arch
yay -S gdu

# Homebrew
brew install gdu

Analyze Disk Usage on Linux using gdu

Some flags used with gdu are as eplained below:

Usage:

$ gdu [directory_to_scan] [flags]

Flags:
-h, --help help for gdu
-i, --ignore-dirs strings Absolute paths to ignore (separated by comma) (default [/proc,/dev,/sys,/run])
-l, --log-file string Path to a logfile (default “/dev/null”)
-c, --no-color Do not use colorized output
-p, --no-progress Do not show progress in non-interactive mode
-n, --non-interactive Do not run in interactive mode
-d, --show-disks Show all mounted disks
-v, --version Print version

Let’s look at some usage examples.

Check gdu version:

$ gdu -v
Version:	 v5.30.1
Built time:	 Mon Dec 30 10:17:46 PM CET 2024
Built user:	 dundee

Show all mounted disks:

gdu -d

Output:

Run gdu -l ./gdu.log <path> and get corresponding logs on ./gdu.log. The command analyzes the specified directory and logs to the specified file.

gdu -l ./gdu.log

A log file is added as specified

$ ls
gdu.log

You can use the following keyboard options to manipulate the directories, for example to select, sort by size, delete etc

  • Up or k – move cursor up
  • Down or j – move cursor down
  • EnterRight or l – select directory / device
  • Left or h – go to parent directory
  • d – delete selected file or directory
  • n – sort by name (asc/desc)
  • s – sort by size (asc/desc)
  • c – sort by items (asc/desc)

As an example, check disk utlization for /.

gdu /

Output:

Now press s to sort the directories from the smallest. Output as below:

That’s it with the installation and usage of gdu disk analyzer on Linux. If you require fast analysis of your disks utilization, especially if working with SSDs the gdu is the appropriate tool to use.

Gdu is pretty fast and enables you to manipulate the disks through the use keyboard keys, for example selecting, sorting according to sizes or names and deleting. I hope the guide has been helpful.

More articles to read:

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

OpenStack private networks enable instances to be reached safely without being exposed to the public internet. Private networks are vital […]

The flavors in OpenStack specify the compute, memory, and storage resources available to virtual machines (instances). The configurations that specify […]

Node.js is an open-source platform built on Chrome’s JavaScript runtime environment to help developers build fast and scalable network applications. […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.