Skip to content

Commit

Permalink
docs: bases for configuration options docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dundee committed Nov 29, 2024
1 parent 11666ca commit 8c2680b
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Flags:
-X, --ignore-from string Read absolute path patterns to ignore from file
-f, --input-file string Import analysis from JSON file
-l, --log-file string Path to a logfile (default "/dev/null")
-m, --max-cores int Set max cores that GDU will use. 8 cores available (default 8)
-m, --max-cores int Set max cores that Gdu will use. 12 cores available (default 12)
-c, --no-color Do not use colorized output
-x, --no-cross Do not cross filesystem boundaries
--no-delete Do not allow deletions
Expand All @@ -69,7 +69,7 @@ Flags:
-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)
--storage-path string Path to persistent key-value storage directory (default is /tmp/badger) (default "/tmp/badger")
--storage-path string Path to persistent key-value storage directory (default "/tmp/badger")
-s, --summarize Show only a total in non-interactive mode
--use-storage Use persistent key-value storage for analysis data (experimental)
-v, --version Print version
Expand Down Expand Up @@ -143,6 +143,8 @@ Gdu can read (and write) YAML configuration file.

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

See the [full list of all configuration options](configuration).

### Examples

* To configure gdu to permanently run in gray-scale color mode:
Expand Down
4 changes: 2 additions & 2 deletions cmd/gdu/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func init() {
flags.StringVarP(&af.LogFile, "log-file", "l", "/dev/null", "Path to a logfile")
flags.StringVarP(&af.OutputFile, "output-file", "o", "", "Export all info into file as JSON")
flags.StringVarP(&af.InputFile, "input-file", "f", "", "Import analysis from JSON file")
flags.IntVarP(&af.MaxCores, "max-cores", "m", runtime.NumCPU(), fmt.Sprintf("Set max cores that GDU will use. %d cores available", runtime.NumCPU()))
flags.IntVarP(&af.MaxCores, "max-cores", "m", runtime.NumCPU(), fmt.Sprintf("Set max cores that Gdu will use. %d cores available", runtime.NumCPU()))
flags.BoolVar(&af.SequentialScanning, "sequential", false, "Use sequential scanning (intended for rotating HDDs)")
flags.BoolVarP(&af.ShowVersion, "version", "v", false, "Print version")

Expand All @@ -61,7 +61,7 @@ func init() {
flags.BoolVar(&af.Profiling, "enable-profiling", false, "Enable collection of profiling data and provide it on http://localhost:6060/debug/pprof/")

flags.BoolVar(&af.UseStorage, "use-storage", false, "Use persistent key-value storage for analysis data (experimental)")
flags.StringVar(&af.StoragePath, "storage-path", "/tmp/badger", "Path to persistent key-value storage directory (default is /tmp/badger)")
flags.StringVar(&af.StoragePath, "storage-path", "/tmp/badger", "Path to persistent key-value storage directory")
flags.BoolVarP(&af.ReadFromStorage, "read-from-storage", "r", false, "Read analysis data from persistent key-value storage")

flags.BoolVarP(&af.ShowDisks, "show-disks", "d", false, "Show all mounted disks")
Expand Down
165 changes: 165 additions & 0 deletions configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@

# YAML file configuration options

Gdu provides an additional set of configuration options to the usual command line options.

You can get the full list of all possible options by running:

```
gdu --write-config
```

This will create file `$HOME/.gdu.yaml` with all the options set to default values.

Let's go through them one by one:

#### `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`

Absolute paths to ignore (separated by comma) (default [/proc,/dev,/sys,/run])

#### `ignore-dir-patterns`

Absolute path regex patterns to ignore (separated by comma)

#### `ignore-from-file`

Read absolute path regex patterns to ignore from file

#### `max-cores`

Set max cores that Gdu will use.

#### `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 number of items in directory

#### `no-color`

Do not use colorized output

#### `no-mouse`

Do not use mouse

#### `non-interactive`

Do not run in interactive mode

#### `no-progress`

Do not show progress in non-interactive mode

#### `no-cross`

Do not cross filesystem boundaries

#### `no-hidden`

Ignore hidden directories (beginning with dot)

#### `no-delete`

Do not allow deletions

#### `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)

#### `profiling`

Enable collection of profiling data and provide it on http://localhost:6060/debug/pprof/

#### `const-gc`

Enable memory garbage collection during analysis with constant level set by GOGC

#### `use-storage`

Use persistent key-value storage for analysis data (experimental)

#### `storage-path`

Path to persistent key-value storage directory (default is /tmp/badger)

#### `read-from-storage`

Read analysis data from persistent key-value storage

#### `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

#### `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

#### `style.selected-row.text-color`

Color of text for the selected row

#### `style.selected-row.background-color`

Color of background for the selected row

#### `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.

#### `sorting.by`

Sort items. Possible values:
* name - name of the item
* size - usage or apparent size
* itemCount - number of items in the folder tree
* mtime - modification time

#### `sorting.order`

Set sorting order. Possible values:
* asc - ascending order
* desc - descending order
114 changes: 114 additions & 0 deletions gdu.1.date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
date: 2024-11-29
section: 1
title: gdu
---

# NAME

gdu - Pretty fast disk usage analyzer written in Go

# SYNOPSIS

**gdu \[flags\] \[directory_to_scan\]**

# DESCRIPTION

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.

# OPTIONS

**-h**, **\--help**\[=false\] help for gdu

**-i**, **\--ignore-dirs**=\[/proc,/dev,/sys,/run\] Absolute paths to
ignore (separated by comma)

**-I**, **\--ignore-dirs-pattern** Absolute path patterns to
ignore (separated by comma)

**-X**, **\--ignore-from** Read absolute path patterns to ignore from file

**-l**, **\--log-file**=\"/dev/null\" Path to a logfile

**-m**, **\--max-cores** Set max cores that Gdu will use.

**-c**, **\--no-color**\[=false\] Do not use colorized output

**-x**, **\--no-cross**\[=false\] Do not cross filesystem boundaries

**-H**, **\--no-hidden**\[=false\] Ignore hidden directories (beginning with dot)

**-L**, **\--follow-symlinks**\[=false\] Follow symlinks for files, i.e. show the
size of the file to which symlink points to (symlinks to directories are not followed)

**-n**, **\--non-interactive**\[=false\] Do not run in interactive mode

**-p**, **\--no-progress**\[=false\] Do not show progress in
non-interactive mode

**-u**, **\--no-unicode**\[=false\] Do not use Unicode symbols (for size bar)

**-s**, **\--summarize**\[=false\] Show only a total in non-interactive mode

**-d**, **\--show-disks**\[=false\] Show all mounted disks

**-a**, **\--show-apparent-size**\[=false\] Show apparent size

**-C**, **\--show-item-count**\[=false\] Show number of items in directory

**-M**, **\--show-mtime**\[=false\] Show latest mtime of items in directory

**\--si**\[=false\] Show sizes with decimal SI prefixes (kB, MB, GB) instead of binary prefixes (KiB, MiB, GiB)

**\--no-prefix**\[=false\] Show sizes as raw numbers without any prefixes (SI or binary) in non-interactive mode

**\--no-mouse**\[=false\] Do not use mouse

**\--no-delete**\[=false\] Do not allow deletions

**-f**, **\--input-file** Import analysis from JSON file. If the file is \"-\", read from standard input.

**-o**, **\--output-file** Export all info into file as JSON. If the file is \"-\", write to standard output.

**\--config-file**=\"$HOME/.gdu.yaml\" Read config from file

**\--write-config**\[=false\] Write current configuration to file (default is $HOME/.gdu.yaml)

**-g**, **\--const-gc**\[=false\] Enable memory garbage collection during analysis with constant level set by GOGC

**\--enable-profiling**\[=false\] Enable collection of profiling data and provide it on http://localhost:6060/debug/pprof/

**\--use-storage**\[=false\] Use persistent key-value storage for analysis data (experimental)

**-r**, **\--read-from-storage**\[=false\] Read analysis data from persistent key-value storage

**-v**, **\--version**\[=false\] Print version

# 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.
2 changes: 1 addition & 1 deletion gdu.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ignore (separated by comma)

**-l**, **\--log-file**=\"/dev/null\" Path to a logfile

**-m**, **\--max-cores** Set max cores that GDU will use.
**-m**, **\--max-cores** Set max cores that Gdu will use.

**-c**, **\--no-color**\[=false\] Do not use colorized output

Expand Down

0 comments on commit 8c2680b

Please sign in to comment.