In this article we will look at the gdu program. It is an analyzer of the used disk space and is open source.
The gdu tool is designed for SSDs where parallel processing can be used. This tool can also work with HDDs with lower performance compared to SSDs. You can also check the results of the benchmark. There are many other similar tools and you must first play with gdu to see if it meets your needs.
How to install
# Using curl:
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
# Arch Linux:
yay -S gdu
# Debian:
dpkg -i gdu_*_amd64.deb
# Ubuntu
add-apt-repository ppa:daniel-milde/gdu
apt-get update
apt-get install gdu
# NixOS:
nix-env -iA nixos.gdu
# Homebrew:
brew install -f gdu
brew link --overwrite gdu # if you have coreutils installed as well
# Snap:
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
# Binenv:
binenv install gdu
# Go:
go get -u github.com/dundee/gdu/v4
Now you can verify the installation by running the following command.
# Check Version
gdu --version
Usage:
If you run the gdu command without an argument, it will scan your current working directory. I am now in my home directory and when I start gdu, you can see from the image below that my home directory is being scanned.
# Examples
gdu # analyze current dir
gdu -a # show apparent size instead of disk usage
gdu <some_dir_to_analyze> # analyze given dir
gdu -d # show all mounted disks
gdu -l ./gdu.log <some_dir> # write errors to log file
gdu -i /sys,/proc / # ignore some paths
gdu -c / # use only white/gray/black colors
gdu -n / # only print stats, do not start interactive mode
gdu -np / # do not show progress, useful when using its output in a script
gdu / > file # write stats to file, do not start interactive mode
Quick install and review video
Alternatives
ncdu - NCurses based tool written in pure C
godu - Analyzer with carousel like user interface
dua - Tool written in Rust with interface similar to gdu (and ncdu)
diskus - Very simple but very fast tool written in Rust
duc - Collection of tools with many possibilities for inspecting and visualising disk usage
dust - Tool written in Rust showing tree like structures of disk usage
We hope you enjoyed this article. if that is so please rate this page with the stars bellow and subscribe to our YouTube channel.