# YAML file configuration options Gdu provides an additional set of configuration options to the usual command line options. To save the options of the current command line to the config file, run: ``` gdu --write-config ... ``` This writes `$HOME/.gdu.yaml` (or the file given with `--config-file`) with what you configured: the settings already in that file, and those the command line changes. Defaults, the system config `/etc/gdu.yaml` and options that only make sense for one run (`input-file`, `output-file`, `output-attrs`, `read-from-storage`, `db`, `since`, `until`, `max-age`, `min-age`) given on the command line are left out. gdu tells on stderr about a config file it cannot read, about a `--config-file` that does not exist, and about keys it does not know, such as a misspelt option. The options are: #### `log-file` Path to a logfile (default "/dev/null") #### `input-file` Import analysis from JSON file #### `output-file` Export all info into file as JSON #### `ignore-dirs` Paths to ignore (separated by comma). Can be absolute (like `/proc`) or relative to the current working directory (like `node_modules`). Default values are [/proc,/dev,/sys,/run]. #### `ignore-dir-patterns` Path patterns to ignore (separated by comma). Patterns can be absolute or relative to the current working directory. #### `ignore-from-file` Read path patterns to ignore from file. Patterns can be absolute or relative to the current working directory. #### `ignore-from-gitignore` Read directories to ignore from a file with [gitignore-style patterns](https://git-scm.com/docs/gitignore). One pattern per line; blank lines and comments (starting with `#`) are skipped. - a name without `/` matches at any depth, so `node_modules` ignores every `node_modules` directory in the tree - a trailing `/` marks a directory and a leading `/` anchors the pattern to the directory being scanned, so `/build` ignores `build` at the top of the scan but not `src/build` - `*` does not cross separators, `**` does; `/` matches either path separator, so patterns written for Unix also match Windows paths - a trailing `/**` means the directory itself (`build/**` = `build`), because gdu prunes whole directories - file patterns such as `*.class` are accepted but have no effect, as gdu only prunes directories Two kinds of pattern are rejected with an error rather than skipped, because both would make gdu quietly report less than is really on disk: - negated patterns (starting with `!`). gdu prunes a whole directory at once, so it never descends into an ignored directory and cannot un-ignore anything inside it. Remove the negation, or remove the pattern it negates. - patterns that match every directory, such as `*`, `**` or `/**`. These are legal gitignore but would hide the entire scan. All pattern sources combine. When `ignore-dir-patterns`, `ignore-from-file` and `ignore-from-gitignore` are given together, a directory is ignored if it matches any of them — nothing is silently dropped because another flag was also set. Paths from `ignore-dirs` apply in addition. #### `max-cores` Set max cores that Gdu will use, at most the number of processors of the machine. 0, the default, leaves it to Go, which follows the CPU limit of a container. #### `sequential-scanning` Use sequential scanning (intended for rotating HDDs) #### `show-apparent-size` Show apparent size #### `show-relative-size` Show relative size #### `show-item-count` Show the item count column. For a directory this is the number of items (files and subdirectories, recursively) it contains, not counting the directory itself; for a file it is 1. #### `show-symlink-target` Show symlink target (`name -> target`) in the file list. Disabled by default. #### `no-color` Do not use colorized output #### `mouse` Use mouse #### `non-interactive` Do not run in interactive mode #### `interactive` Force interactive mode even when output is not a TTY #### `no-progress` Do not show progress in non-interactive mode #### `no-cross` Do not cross filesystem boundaries. On Linux, same-filesystem bind mounts (including read-only mounts) remain included. Mounts on other filesystems remain excluded. Explicit ignore rules still apply. #### `no-hidden` Ignore hidden directories (beginning with dot) #### `no-delete` Do not allow deletions Applies to the web UI as well as the terminal UI: the web UI hides its delete action and the server rejects delete requests, so it cannot be re-enabled from the browser. Reveal remains available in the web UI because it does not modify scanned data. Deletion while a filter is active is disabled by default: the terminal UI applies this to time filters, the web UI to any active filter, file-type filters included. Set `GDU_ALLOW_DELETE_WITH_FILTER=1` to override the check. The displayed tree may then omit files that are still present on disk. #### `no-view-file` Do not allow viewing file contents #### `no-confirm-quit` Do not ask for confirmation before quitting after a long scan. By default, pressing `q`/`Q` after a scan that took more than a few seconds shows a confirmation dialog so that results are not lost by an accidental key press. With a database (`db`), a scan that has ended is saved, so quitting after it does not ask; quitting while a scan is still running does. #### `ctrl-c-quits` Quit gdu when `Ctrl+C` is pressed during a scan, instead of stopping the scan and keeping the results found so far. By default, `Ctrl+C` during a scan produces a stopped scan: no new work is scheduled and the results found so far are kept. Set this option if you prefer `Ctrl+C` to behave the way it does in most other programs and exit gdu instead. Quitting this way is immediate and unconditional — the confirmation dialog described under `no-confirm-quit` is not shown, because `Ctrl+C` is treated as a stronger signal than `q`. `Esc` always stops the scan and keeps the results, regardless of this option, so the behaviour remains reachable. This option only has an effect while a scan is running; outside a scan `Ctrl+C` already quits gdu. #### `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) #### `exclusive-size` Linux and macOS only: report disk usage of files as the bytes not shared with other files through reflinks or APFS clones, i.e. what deleting them would free. Falls back to allocated blocks where the filesystem cannot report them. Ignored on other platforms. See [Reflinks and shared extents](README.md#reflinks-and-shared-extents). #### `profiling` Enable collection of profiling data and provide it on http://localhost:6060/debug/pprof/ #### `read-from-storage` Show the analysis stored by an earlier scan in the database set by `db`, instead of scanning. Requires `db`, and the directory the analysis was stored for #### `summarize` Show only a total in non-interactive mode #### `use-si-prefix` Show sizes with decimal SI prefixes (kB, MB, GB) instead of binary prefixes (KiB, MiB, GiB) #### `no-prefix` Show sizes as raw numbers without any prefixes (SI or binary) in non-interactive mode #### `reverse-sort` Reverse the sorting order in non-interactive mode (smallest to largest by default) #### `change-cwd` Set CWD variable when browsing directories #### `delete-in-background` Delete items in the background, not blocking the UI from work #### `delete-in-parallel` Delete items in parallel, which might increase the speed of deletion #### `trash-command` Command used by the `D` key to move items to trash, replacing the built-in [FreeDesktop trash](https://specifications.freedesktop.org/trash/latest/) implementation. Useful to trash into a non-default location, or to use a different trash tool. On macOS the built-in trash runs the system `/usr/bin/trash` (macOS 15 and later), which moves items into the Finder trash; on older releases set this option to a trash CLI instead. The command is evaluated by `/bin/sh` with the absolute path of the item appended as an argument, so shell syntax such as variable expansion works: ```yaml trash-command: trash-put --trash-dir ~/mytrash ``` ##### Using `mv` Commands taking their destination last would receive the item path in the wrong place. Refer to the path explicitly as `"$1"` and it is not appended: ```yaml trash-command: mv -f "$1" ~/mytrash/ ``` Note the trailing slash on the destination: without it, `mv` renames the item to `~/mytrash` when that directory does not exist, quietly replacing whatever was there. With it, a missing trash dir becomes an error dialog instead. Unlike a real trash tool, `mv` overwrites an item of the same name that was trashed earlier, and records nothing that would allow restoring the item to its original location. Further details: * The path is passed as a positional shell parameter, so item names are never interpreted as shell syntax. * The path is appended to the command unless the command refers to it itself via `$1`, `$@` or `$*`. An appended path needs the command to end where an argument can follow (`gio trash --` works, `some-command;` does not); otherwise use `"$1"`. * The absolute path is also exported as the `GDU_TRASH_PATH` environment variable. * The command must not be interactive. It gets no terminal, the UI keeps running while it executes, and with `delete-in-background` it may even run from a background worker. * When the command fails, its exit status and standard error output are shown in an error dialog and the item stays in the listing. * When the command succeeds but the item is still present on disk, the item stays in the listing as well. Only the selected item is refreshed, so an item moved elsewhere by the command is not picked up at its new location. * `no-delete` disables the `D` key regardless of this option. * Also used by the web UI's "Move to Trash" action, under the same contract. The web UI reports an item the command left in place as an error. * Not supported on Windows, which has no POSIX shell to evaluate the command in. #### `shell` Set the shell spawned with the `b` key in the interactive UI. It takes precedence over the platform default. The value is the path to the shell executable; arguments are not supported. An empty value keeps the platform default. `no-spawn-shell` disables the `b` key regardless of this option. ```yaml shell: /usr/bin/fish ``` #### `browse-parent-dirs` Allow navigating above the launch directory by pressing the left arrow key. When enabled, pressing left at the top-level directory will rescan and open its parent directory. Disabled by default. #### `web.listen` Address the web UI (`--web`) listens on, e.g. `localhost:8080`. When empty (the default), Gdu binds to `localhost` on a random free port. Reading file names and sizes needs the token in the URL gdu prints. Binding to a non-loopback address exposes them, with that URL, to other hosts on the network over unencrypted HTTP, and prints a warning. #### `web.open-browser` Whether the web UI opens in the default browser on start. Enabled by default. The URL is always printed regardless of this setting. Can be overridden on the command line with `--web-open=false`. #### `web.browser` Override the command used to open the browser (the URL is appended as the final argument), e.g. `firefox --new-window`. When empty (the default), the operating system's default handler is used. #### `cleanup.exclude` Paths the web UI's cleanup projections never mark as candidates, nor anything below them. A leading `~/` stands for the home directory. A matched directory that holds an excluded path is not offered as a whole: its other children are marked instead, so deleting a highlighted candidate never takes an excluded item with it. Excluding a path does not protect it from a deliberate deletion. ```yaml cleanup: exclude: - ~/work/current-project ``` #### `cleanup.rules` Extra rules for the web UI's cleanup projections, checked before the built-in ones. The first rule that matches an item decides its category. Each rule has: * `category` - required, one of `build-artifact`, `package-cache`, `app-cache`, `toolchain`, `ml-model`, `installer` and `git-ignored`. * `confidence` - `safe` (regenerated on demand) or `review` (probably unneeded, but check first). Defaults to `review`. * Exactly one of: * `dir` - a glob matched against the name of directories, e.g. `.gradle`. * `file` - a glob matched against the name of files, e.g. `*.gguf`. * `path` - a glob matched against the absolute path of any item, e.g. `~/.cache/my-tool`. A leading `~/` stands for the home directory, and `*` does not match `/`. * `under` - only match items below this directory, e.g. `~/Downloads`. * `markers` - only match when the item has a sibling with one of these names, e.g. `package.json` for `node_modules`. Markers may be globs, e.g. `*.xcodeproj`. * `hint` - shown with the candidate, e.g. how to remove it cleanly. A matched directory is a unit: the items inside it show its category but are not candidates of their own. When an excluded path or the path of a more specific `path` rule lies below it, it is split instead and its children become units, so the more specific rule wins where it matches. Items no rule matches but a repository's `.gitignore` ignores are `git-ignored` candidates to review. ```yaml cleanup: rules: - category: build-artifact confidence: safe dir: .gradle markers: [build.gradle, build.gradle.kts] hint: Rebuilt by Gradle - category: ml-model path: ~/models/* ``` #### `style.selected-row.text-color` Color of text for the selected row #### `style.selected-row.background-color` Background color for the selected row #### `style.marked.text-color` Color of text for marked items #### `style.marked.background-color` Background color for marked items #### `style.progress-modal.current-item-path-max-len` Maximum length of file path for the current item in progress bar. When the length is reached, the path is shortened with "/.../". #### `style.use-old-size-bar` Show size bar without Unicode symbols. #### `style.show-bar-percentage` Show the numeric usage percentage (e.g. `61.4%`) next to the size bar in the directory listing. #### `style.show-item-count-bar` Show a bar next to the item count, drawn in proportion to the item counts of the other items in the same directory, in the same way the size bar works for sizes. Disabled by default. The bar is only drawn while the item count column itself is visible, so enable it together with `show-item-count` or toggle the column with the `c` key. Like the size bar, it is measured against the sum of the items in the listing, or against the largest one when `show-relative-size` is set. #### `style.footer.text-color` Color of text for footer bar #### `style.footer.background-color` Background color for footer bar #### `style.footer.number-color` Color of numbers displayed in the footer #### `style.header.text-color` Color of text for header bar #### `style.header.background-color` Background color for header bar #### `style.header.hidden` Hide the header bar #### `style.result-row.number-color` Color of numbers in result rows #### `style.result-row.directory-color` Color of directory names in result rows #### `sorting.by` Sort items. Possible values: * name - name of the item * size - usage or apparent size * itemCount - number of items contained in the folder tree (the same number shown by `show-item-count`) * mtime - modification time Applies to interactive listings and non-interactive listings, including `--depth`. `--top` keeps selecting the largest files by the displayed size metric. #### `sorting.order` Set sorting order. Possible values: * asc - ascending order * desc - descending order In non-interactive mode, `--reverse-sort` reverses the configured order. With no configured order, the default remains largest first.