github dundee/gdu v5.39.0

one hour ago

What's New

This release helps you find what is safe to delete in the web UI, adds a working
trash on macOS, reports the space reflinked files really take up, and fixes a
number of disk usage miscounts. Below is a walkthrough of each change.

Cleanup projections in the web UI

The treemap can now highlight what is safe to clean up. Use the projection
selector in the header (or press P) to switch the coloring. The tile area
always stays the size:

  • Location - the default coloring by top-level directory.
  • Cleanup - everything is grey except cleanup candidates. Safe ones are
    strong orange. These are regenerated by their tool, e.g. node_modules next
    to package.json, target next to Cargo.toml, __pycache__, the Go,
    Gradle, Cargo, npm, uv and Homebrew caches, and app caches. Ones to review
    first
    are muted gold: downloaded ML models, installed toolchains such as
    ~/.rustup or ~/.nvm, installers, virtualenvs, dist/build and
    git-ignored files.
  • Age - colored by the latest change inside an item.
  • By category - candidates in the current directory grouped by category, so
    cache space spread over many small directories shows up as one block.

The legend shows how much space each category takes. Click a category to
highlight only its items. Hovering a candidate shows what it is and how to
remove it cleanly (e.g. ollama rm for Ollama models). Candidates are found in
the background after the scan and are only highlighted. Deleting them is still
up to you.

Paths can be excluded and custom rules added in the cleanup section of the
config file:

cleanup:
  exclude: [~/work/current-project]
  rules:
    - category: build-artifact
      confidence: safe
      dir: .gradle
      markers: [build.gradle, build.gradle.kts]
      hint: Rebuilt by Gradle

Deletion in the web UI now runs in the background. The item is drawn hatched
right away, you can delete more items and keep browsing in the meantime, and if
a deletion fails, the item comes back with the reason.

by @mikhail-angelov in #697

Move to trash on macOS

The D key in the terminal UI and "Move to Trash" in the web UI now work on
macOS with no setup. Gdu runs the system /usr/bin/trash command, which moves
items into the Finder trash so you can put them back from there. It ships with
macOS 15 (Sequoia) and later. On older releases, gdu shows an error that points
you to --trash-command.

by @mikhail-angelov in #698

Exclusive size for reflinked files

On filesystems with reflinks (XFS, btrfs, bcachefs, ...) several files can share
the same data. stat counts that shared data once for every file, so a
directory full of clones looks huge even though deleting it frees almost
nothing. The new --exclusive-size flag (Linux only) counts only the bytes a
file does not share with other files, which is what deleting it would free:

gdu --exclusive-size /some/dir

The figure replaces disk usage everywhere (sorting, bars, totals and the dsize
value in exports). Apparent size is unchanged. Exports gain an optional shsize
key with the shared bytes, which can also be selected with --output-attrs.
Where a filesystem does not support the needed FIEMAP call, gdu falls back to
the regular figure. See
Reflinks and shared extents
for details.

by @jamesbraid in #710

Unreadable directories marked in JSON exports

The JSON export used to look exactly the same whether the scan was complete or
not. A directory that gdu could not fully read is now written with
"read_error":true (the same key ncdu uses) and gets its ! flag back when you
import the file. The key is written regardless of --output-attrs.

by @jamesbraid in #712

Choose the shell opened with the b key

The shell spawned with the b key can now be set with --shell or in the
configuration file:

gdu --shell /usr/bin/fish
shell: /usr/bin/fish

On Windows, gdu now stays open when you exit the shell instead of quitting.

by @timbretimber in #722 and #721

More accurate disk usage

Several miscounts were fixed:

  • Directories are now charged the blocks they really use, as du does. Small
    XFS directories stored inline report 0 instead of 4 KiB. On other
    filesystems, the directory's own blocks are added to the total. (@shivampwm2020, #694)
  • Hard links in the scanned root directory are counted once, so the default
    non-interactive scan no longer reports up to twice the real usage. (@mabunemeh, #709)
  • Windows: files compressed with NTFS compression and sparse files count
    their size on disk instead of their full length. (@nk-batman21, #713)
  • OneDrive online-only files now show zero disk usage and keep their real
    apparent size. Previously it was the other way around. (@AdamMagued, #692)

Better --no-cross (-x)

  • -x no longer crosses into btrfs subvolumes and snapshots. Like du -x, it
    now skips any directory on a different device than its parent. (@simon04, #711)
  • Mount points are found correctly when the scanned path is a symlink, such as
    /Volumes/Macintosh HD on macOS. (@itssali, #705)

Non-interactive output fixes

  • sorting.by and sorting.order from the configuration file are now honored
    in non-interactive listings, including --depth. --reverse-sort reverses
    the configured order. (@kok-o, #703)
  • --show-item-count prints the same count as the TUI and web UI, whichever
    analyzer is used. (@LuisFigueroaG, #691)
  • Empty and unreadable top-level directories are marked with e and !.
    (@LuisFigueroaG, #716)

Summary of all changes

  • feat(webui): highlight files that are safe to clean up by @dundee in #697
  • feat: trash for MacOS by @dundee in #698
  • feat: add --exclusive-size to report bytes not shared by reflinks by @jamesbraid in #710
  • feat: mark unreadable directories in the JSON export by @jamesbraid in #712
  • feat: add option to configure shell opened with b key by @timbretimber in #722
  • fix: report actual st_blocks for directories (XFS inline dirs) by @shivampwm2020 in #694
  • fix(analyze): count root-level hard links only once by @mabunemeh in #709
  • fix(analyze): use on-disk size for compressed and sparse files on Windows by @nk-batman21 in #713
  • fix(analyze): zero disk usage instead of apparent size for online-only files by @AdamMagued in #692
  • fix: -x does not cross into btrfs subvolumes and snapshots by @simon04 in #711
  • fix(device): resolve symlinks in the scanned root for --no-cross by @itssali in #705
  • fix(stdout): honor configured sorting in non-interactive listings by @kok-o in #703
  • fix(stdout): print the displayed item count with --show-item-count by @LuisFigueroaG in #691
  • fix(stdout): mark empty and unreadable top-level directories by @LuisFigueroaG in #716
  • fix(tui): keep tui open after shell exit on windows by @timbretimber in #721
  • fix(tui): clarify export shortcut in quit warning by @voidsipp in #717
  • fix: make install-dev-dependencies by @dcadolph in #704
  • chore(deps): bump golang.org/x/text from 0.41.0 to 0.43.0 by @dependabot[bot] in #677
  • chore(deps): bump github.com/ebitengine/purego from 0.10.2 to 0.11.2 by @dependabot[bot] in #678
  • chore(deps): bump golang.org/x/sys from 0.47.0 to 0.49.0 by @dependabot[bot] in #679
  • chore(deps): bump github.com/ulikunitz/xz from 0.5.15 to 0.5.17 by @dependabot[bot] in #680
  • chore(deps): bump github.com/klauspost/compress from 1.18.1 to 1.18.7 by @dependabot[bot] in #702
  • chore(deps): bump modernc.org/sqlite from 1.59.0 to 1.61.0 by @dependabot[bot] in #715
  • chore(deps): bump github/codeql-action from 4.38.1 to 4.39.1 by @dependabot[bot] in #707
  • chore(deps): bump docker/login-action from 4.6.0 to 4.7.0 by @dependabot[bot] in #708
  • chore(deps): bump source-map-js from 1.2.1 to 1.2.2 in /webui/frontend by @dependabot[bot] in #699
  • chore(deps-dev): bump vite from 8.2.1 to 8.3.5 in /webui/frontend by @dependabot[bot] in #701
  • chore(deps): bump @vitest/mocker and vitest in /webui/frontend by @dependabot[bot] in #706

New Contributors

Full Changelog: v5.38.0...v5.39.0

Don't miss a new gdu release

NewReleases is sending notifications on new releases.