NCDU(1) | General Commands Manual | NCDU(1) |
ncdu
— NCurses
Disk Usage
ncdu |
[-f file]
[-o file]
[-e , --extended ,
--no-extended ]
[--ignore-config ] [-x ,
--one-file-system ,
--cross-file-system ]
[--exclude pattern]
[-X , --exclude-from
file] [--include-caches ,
--exclude-caches ] [-L ,
--follow-symlinks ,
--no-follow-symlinks ]
[--include-kernfs ,
--exclude-kernfs ]
[--exclude-firmlinks ,
--follow-firmlinks ] [-0 ,
-1 , -2 ]
[-q , --slow-ui-updates ,
--fast-ui-updates ]
[--enable-shell ,
--disable-shell ]
[--enable-delete ,
--disable-delete ]
[--enable-refresh ,
--disable-refresh ] [-r ]
[--si , --no-si ]
[--disk-usage ,
--apparent-size ]
[--show-hidden ,
--hide-hidden ]
[--show-itemcount ,
--hide-itemcount ]
[--show-mtime ,
--hide-mtime ]
[--show-graph ,
--hide-graph ]
[--show-percent ,
--hide-percent ] [--sort
column] [--enable-natsort ,
--disable-natsort ]
[--group-directories-first ,
--no-group-directories-first ]
[--confirm-quit ,
--no-confirm-quit ]
[--confirm-delete ,
--no-confirm-delete ]
[--color off |
dark | dark-bg]
[path] |
ncdu |
[-h , --help ] |
ncdu |
[-v , -V ,
--version ] |
ncdu
(NCurses Disk Usage) is an
interactive curses-based version of the well-known
du(1), and provides a fast way to see what
directories are using your disk space.
-h
,
--help
-v
,
-V
, --version
-f
file-o
flag. If file is
equivalent to '-', the file is read from standard input.
For the sake of preventing a screw-up, the current version of
ncdu
will assume that the directory information
in the imported file does not represent the filesystem on which the file
is being imported. That is, the refresh, file deletion and shell
spawning options in the browser will be disabled.
-o
fileBe warned that the exported data may grow quite large when exporting a directory with many files. 10.000 files will get you an export in the order of 600 to 700 KiB uncompressed, or a little over 100 KiB when compressed with gzip. This scales linearly, so be prepared to handle a few tens of megabytes when dealing with millions of files.
-e
,
--extended
,
--no-extended
When using the file export/import function, this flag should be added both when exporting (to make sure the information is added to the export) and when importing (to read this extra information in memory). This flag has no effect when importing a file that has been exported without the extended information.
This enables viewing and sorting by the latest child mtime, or modified time, using 'm' and 'M', respectively.
--ignore-config
These options affect the scanning progress, they have no effect when importing directory information from a file.
-x
,
--one-file-system
--cross-file-system
-x
.--exclude
pattern-X
,
--exclude-from
file--include-caches
,
--exclude-caches
-L
,
--follow-symlinks
,
--no-follow-symlinks
--include-kernfs
,
--exclude-kernfs
The complete list of currently known pseudo filesystems is: binfmt, bpf, cgroup, cgroup2, debug, devpts, proc, pstore, security, selinux, sys, trace.
--exclude-firmlinks
,
--follow-firmlinks
-0
-o
, ncurses will not be initialized at all. This
option is the default when exporting to standard output.-1
-0
, but does give feedback on the
scanning progress with a single line of output. This option is the default
when exporting to a file.
In some cases, the ncurses browser interface which you'll see
after the scan/import is complete may look garbled when using this
option. If you're not exporting to a file, -2
is
usually a better choice.
-2
-q
,
--slow-ui-updates
,
--fast-ui-updates
ncdu
updates the screen 10 times a second by
default (with --fast-ui-updates
), this can be
decreased to once every 2 seconds with -q
or
--slow-ui-updates
. This option can be used to save
bandwidth over remote connections. This option has no effect in
combination with -0
.--enable-shell
,
--disable-shell
--enable-delete
,
--disable-delete
--enable-refresh
,
--disable-refresh
-r
--disable-delete
, when given twice it will also
add --disable-shell
, thus ensuring that there is
no way to modify the file system from within
ncdu
.--si
,
--no-si
--disk-usage
,
--apparent-size
--show-hidden
,
--hide-hidden
--show-itemcount
,
--hide-itemcount
--show-mtime
,
--hide-mtime
-e
.--show-graph
,
--hide-graph
--show-percent
,
--hide-percent
--sort
column-e
.
The column name can be suffixed with
-asc
or -desc
to change
the order to ascending or descending, respectively. For example,
--sort=name-desc
to sort by name in descending
order.
--enable-natsort
,
--disable-natsort
--group-directories-first
,
--no-group-directories-first
--confirm-quit
,
--no-confirm-quit
--confirm-delete
,
--no-confirm-delete
--color
off | dark |
dark-bgThe default is off.
ncdu
can be configured by placing
command-line options in /etc/ncdu.conf or
$HOME/.config/ncdu/config. If both files exist, the
system configuration will be loaded before the user configuration, allowing
users to override options set in the system configuration. Options given on
the command line will override options set in the configuration files. The
files will not be read at all when --ignore-config
is given on the command line.
The configuration file format is simply one command line option per line. Lines starting with '#' are ignored. Example configuration file:
# Always enable extended mode -e # Disable file deletion --disable-delete # Exclude .git directories --exclude .git
-e
flag.-e
flag.ncdu
determines your preferred shell
from the NCDU_SHELL
or
SHELL
environment variable (in that order), or
calls /bin/sh if neither are set. This allows
you to also configure another command to be run when he 'b' key is
pressed. For example, to spawn the
vifm(1) file manager instead of a
shell, run ncdu
as follows:
NCDU_SHELL=vifm ncdu
NCDU_LEVEL
environment variable is set or
incremented before spawning the shell, allowing you to detect if your
shell is running from within ncdu
. This can be
useful to avoid nesting multiple instances, although
ncdu
itself does not (currently) warn about or
prevent this situation.Entries in the browser interface may be prefixed by a one-character flag. These flags have the following meaning:
To scan and browse the directory you're currently in, all you need is a simple:
ncdu
-x
:
ncdu -x /
Since scanning a large directory may take a while, you can scan a directory and export the results for later viewing:
ncdu -1xo- / | gzip >export.gz # ...some time later: zcat export.gz | ncdu -f-
-1
with
-0
to suppress any unnecessary output.
You can also export a directory and browse it once scanning is done:
ncdu -o- | tee export.file | ./ncdu
-f-
ncdu -o- | gzip | tee export.gz |
gunzip | ./ncdu -f-
To scan a system remotely, but browse through the files locally:
ssh -C user@system ncdu -o- / |
./ncdu -f-
-C
option to ssh enables compression, which will be
very useful over slow links. Remote scanning and local viewing has two major
advantages when compared to running ncdu
directly on
the remote system: You can browse through the scanned directory on the local
system without any network latency, and ncdu
does not
keep the entire directory structure in memory when exporting, so this won't
consume much memory on the remote system.
ncdu
has a website:
https://dev.yorhel.nl/ncdu
Written by Yorhel <projects@yorhel.nl>
Directory hard links are not supported. They are not detected as being hard links, and will thus get scanned and counted multiple times.
Some minor glitches may appear when displaying filenames that contain multibyte or multicolumn characters.
All sizes are internally represented as a signed 64bit integer. If you have a directory larger than 8 EiB minus one byte, ncdu will clip its size to 8 EiB minus one byte. When deleting or refreshing items in a directory with a clipped size, the resulting sizes will be incorrect. Item counts are stored in a 32-bit integer without overflow detection. If you have a directory with more than 2 billion files, quite literally anything can happen.
On macOS 10.15 and later, running ncdu on the root directory
without --exclude-firmlinks
may cause directories to
be scanned and counted multiple times. Firmlink cycles are not detected, so
it may also cause ncdu
to get stuck in an infinite
loop and eventually run out of memory.
Please report any other bugs you may find at the bug tracker, which can be found on the web site at https://dev.yorhel.nl/ncdu
November 19, 2024 | x86_64 |