SkillAgentSearch skills...

Gdu

Fast disk usage analyzer with console interface written in Go

Install / Use

/learn @dundee/Gdu
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

go DiskUsage()

<img src="./gdu.png" alt="Gdu " width="200" align="right">

Codecov Go Report Card Maintainability CodeScene Code Health

Pretty fast disk usage analyzer written in Go.

Gdu is intended primarily for SSD disks where it can fully utilize parallel processing. However HDDs work as well, but the performance gain is not so huge.

asciicast

<a href="https://repology.org/project/gdu/versions"> <img src="https://repology.org/badge/vertical-allrepos/gdu.svg" alt="Packaging status" align="right"> </a>

Installation

Head for the releases page and download the binary for your system.

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

See the installation page for other ways how to install Gdu to your system.

Or you can use Gdu directly via Docker:

docker run --rm --init --interactive --tty --privileged --volume /:/mnt/root ghcr.io/dundee/gdu /mnt/root

Usage

  gdu [directory_to_scan] [flags]

Flags:
      --archive-browsing              Enable browsing of zip/jar/tar archives (tar, tar.gz, tar.bz2, tar.xz)
      --collapse-path                 Collapse single-child directory chains
      --config-file string            Read config from file (default is $HOME/.gdu.yaml)
  -D, --db string                     Store analysis in database (*.sqlite for SQLite, *.badger for BadgerDB)
      --depth int                     Show directory structure up to specified depth in non-interactive mode (0 means the flag is ignored)
      --enable-profiling              Enable collection of profiling data and provide it on http://localhost:6060/debug/pprof/
  -E, --exclude-type strings          File types to exclude (e.g., --exclude-type yaml,json)
  -L, --follow-symlinks               Follow symlinks for files, i.e. show the size of the file to which symlink points to (symlinks to directories are not followed)
  -h, --help                          help for gdu
  -i, --ignore-dirs strings           Paths to ignore (separated by comma). Can be absolute or relative to current directory (default [/proc,/dev,/sys,/run])
  -I, --ignore-dirs-pattern strings   Path patterns to ignore (separated by comma)
  -X, --ignore-from string            Read path patterns to ignore from file
  -f, --input-file string             Import analysis from JSON file
      --interactive                   Force interactive mode even when output is not a TTY
  -l, --log-file string               Path to a logfile (default "/dev/null")
      --max-age string                Include files with mtime no older than DURATION (e.g., 7d, 2h30m, 1y2mo)
  -m, --max-cores int                 Set max cores that Gdu will use. 8 cores available (default 8)
      --min-age string                Include files with mtime at least DURATION old (e.g., 30d, 1w)
      --mouse                         Use mouse
  -c, --no-color                      Do not use colorized output
  -x, --no-cross                      Do not cross filesystem boundaries
      --no-delete                     Do not allow deletions
  -H, --no-hidden                     Ignore hidden directories (beginning with dot)
      --no-prefix                     Show sizes as raw numbers without any prefixes (SI or binary) in non-interactive mode
  -p, --no-progress                   Do not show progress in non-interactive mode
      --no-spawn-shell                Do not allow spawning shell
  -u, --no-unicode                    Do not use Unicode symbols (for size bar)
      --no-view-file                  Do not allow viewing file contents
  -n, --non-interactive               Do not run in interactive mode
  -o, --output-file string            Export all info into file as JSON
  -r, --read-from-storage             Use existing database instead of re-scanning
      --reverse-sort                  Reverse sorting order (smallest to largest) in non-interactive mode
      --sequential                    Use sequential scanning (intended for rotating HDDs)
  -A, --show-annexed-size             Use apparent size of git-annex'ed files in case files are not present locally (real usage is zero)
  -a, --show-apparent-size            Show apparent size
  -d, --show-disks                    Show all mounted disks
  -k, --show-in-kib                   Show sizes in KiB (or kB with --si) in non-interactive mode
  -C, --show-item-count               Show number of items in directory
  -M, --show-mtime                    Show latest mtime of items in directory
  -B, --show-relative-size            Show relative size
      --si                            Show sizes with decimal SI prefixes (kB, MB, GB) instead of binary prefixes (KiB, MiB, GiB)
      --since string                  Include files with mtime >= WHEN. WHEN accepts RFC3339 timestamp (e.g., 2025-08-11T01:00:00-07:00) or date only YYYY-MM-DD (calendar-day compare; includes the whole day)
  -s, --summarize                     Show only a total in non-interactive mode
  -t, --top int                       Show only top X largest files in non-interactive mode
  -T, --type strings                  File types to include (e.g., --type yaml,json)
      --until string                  Include files with mtime <= WHEN. WHEN accepts RFC3339 timestamp or date only YYYY-MM-DD
  -v, --version                       Print version
      --write-config                  Write current configuration to file (default is $HOME/.gdu.yaml)

Basic list of actions in interactive mode (show help modal for more):
  ↑ or k                              Move cursor up
  ↓ or j                              Move cursor down
  → or Enter or l                     Go to highlighted directory
  ← or h                              Go to parent directory
  d                                   Delete the selected file or directory
  e                                   Empty the selected directory
  n                                   Sort by name
  s                                   Sort by size
  c                                   Show number of items in directory
  ?                                   Show help modal

Examples

gdu                                   # analyze current dir
gdu -a                                # show apparent size instead of disk usage
gdu --no-delete                       # prevent write operations
gdu --no-view-file                    # prevent viewing file contents
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 -I '.*[abc]+'                     # ignore paths by regular pattern
gdu -X ignore_file /                  # ignore paths by regular patterns from file
gdu -c /                              # use only white/gray/black colors

gdu -n /                              # only print stats, do not start interactive mode
gdu --interactive / | tee out.txt     # force interactive mode even when stdout is piped
gdu -p /                              # do not show progress, useful when using its output in a script
gdu -ps /some/dir                     # show only total usage for given dir
gdu -t 10 /                           # show top 10 largest files
gdu --reverse-sort -n /               # show files sorted from smallest to largest in non-interactive mode
gdu / > file                          # write stats to file, do not start interactive mode

gdu -o- / | gzip -c >report.json.gz   # write all info to JSON file for later analysis
zcat report.json.gz | gdu -f-         # read analysis from file

GOGC=10 gdu -g --use-storage /        # use persistent key-value storage for saving analysis data
gdu -r /                              # read saved analysis data from persistent key-value storage

Modes

Gdu has three modes: interactive (default), non-interactive and export.

Non-interactive mode is started automatically when TTY is not detected (using go-isatty), for example if the output is being piped to a file, or it can be started explicitly by using a flag. Use --interactive to disable this automatic fallback and force interactive mode.

Export mode (flag -o) outputs all usage data as JSON, which can be later opened using the -f flag.

Hard links are counted only once.

File flags

Files and directories may be prefixed by a one-character flag with following meaning:

  • ! An error occurred while reading this directory.

  • . An error occurred while reading a subdirectory, size may be not correct.

  • @ File is symlink or socket.

  • H Same file was already counted (hard link).

  • e Directory is empty.

Configuration file

Gdu can read (and write) YAML configuration file.

$HOME/.config/gdu/gdu.yaml and $HOME/.gdu.yaml are checked for the presence of the config file by default.

See the full list of all configuration options.

Examples

  • To configure gdu to permanently run in gray-scale color mode:
echo "no-color: true" >> ~/.gdu.yaml
  • To set default sorting in configuration file:
sorting:
    by: name // size, name, itemCount, mtime
    order: desc
View on GitHub
GitHub Stars5.5k
CategoryDevelopment
Updated53m ago
Forks196

Languages

Go

Security Score

100/100

Audited on Apr 1, 2026

No findings