1NCDU(1)                           ncdu manual                          NCDU(1)
2
3
4

NAME

6       ncdu - NCurses Disk Usage
7

SYNOPSIS

9       ncdu [options] dir
10

DESCRIPTION

12       ncdu (NCurses Disk Usage) is a curses-based version of the well-known
13       'du', and provides a fast way to see what directories are using your
14       disk space.
15

OPTIONS

17   Mode Selection
18       -h, --help
19           Print a short help message and quit.
20
21       -v, -V, --version
22           Print ncdu version and quit.
23
24       -f FILE
25           Load the given file, which has earlier been created with the "-o"
26           option. If FILE is equivalent to "-", the file is read from
27           standard input.
28
29           For the sake of preventing a screw-up, the current version of ncdu
30           will assume that the directory information in the imported file
31           does not represent the filesystem on which the file is being
32           imported. That is, the refresh, file deletion and shell spawning
33           options in the browser will be disabled.
34
35       dir Scan the given directory.
36
37       -o FILE
38           Export all necessary information to FILE instead of opening the
39           browser interface. If FILE is "-", the data is written to standard
40           output.  See the examples section below for some handy use cases.
41
42           Be warned that the exported data may grow quite large when
43           exporting a directory with many files. 10.000 files will get you an
44           export in the order of 600 to 700 KiB uncompressed, or a little
45           over 100 KiB when compressed with gzip. This scales linearly, so be
46           prepared to handle a few tens of megabytes when dealing with
47           millions of files.
48
49       -e  Enable extended information mode. This will, in addition to the
50           usual file information, also read the ownership, permissions and
51           last modification time for each file. This will result in higher
52           memory usage (by roughly ~30%) and in a larger output file when
53           exporting.
54
55           When using the file export/import function, this flag will need to
56           be added both when exporting (to make sure the information is added
57           to the export), and when importing (to read this extra information
58           in memory). This flag has no effect when importing a file that has
59           been exported without the extended information.
60
61           This enables viewing and sorting by the latest child mtime, or
62           modified time, using 'm' and 'M', respectively.
63
64   Interface options
65       -0  Don't give any feedback while scanning a directory or importing a
66           file, other than when a fatal error occurs. Ncurses will not be
67           initialized until the scan is complete. When exporting the data
68           with "-o", ncurses will not be initialized at all. This option is
69           the default when exporting to standard output.
70
71       -1  Similar to "-0", but does give feedback on the scanning progress
72           with a single line of output. This option is the default when
73           exporting to a file.
74
75           In some cases, the ncurses browser interface which you'll see after
76           the scan/import is complete may look garbled when using this
77           option. If you're not exporting to a file, "-2" is probably a
78           better choice.
79
80       -2  Provide a full-screen ncurses interface while scanning a directory
81           or importing a file. This is the only interface that provides
82           feedback on any non-fatal errors while scanning.
83
84       -q  Quiet mode. While scanning or importing the directory, ncdu will
85           update the screen 10 times a second by default, this will be
86           decreased to once every 2 seconds in quiet mode. Use this feature
87           to save bandwidth over remote connections. This option has no
88           effect when "-0" is used.
89
90       -r  Read-only mode. This will disable the built-in file deletion
91           feature. This option has no effect when "-o" is used, because there
92           will not be a browser interface in that case. It has no effect when
93           "-f" is used, either, because the deletion feature is disabled in
94           that case anyway.
95
96           WARNING: This option will only prevent deletion through the file
97           browser. It is still possible to spawn a shell from ncdu and delete
98           or modify files from there. To disable that feature as well, pass
99           the "-r" option twice (see "-rr").
100
101       -rr In addition to "-r", this will also disable the shell spawning
102           feature of the file browser.
103
104       --si
105           List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB,
106           etc), as defined in the International System of Units (SI), instead
107           of the usual base 2 prefixes, that is, powers of 1024 (KiB, MiB,
108           etc).
109
110       --confirm-quit
111           Requires a confirmation before quitting ncdu. Very helpful when you
112           accidentally press 'q' during or after a very long scan.
113
114       --color SCHEME
115           Select a color scheme. The following schemes are recognized: off to
116           disable colors, dark for a color scheme intended for dark
117           backgrounds and dark-bg for a variation of the dark color scheme
118           that also works in terminals with a light background.
119
120           The default is dark-bg unless the "NO_COLOR" environment variable
121           is set.
122
123   Scan Options
124       These options affect the scanning progress, and have no effect when
125       importing directory information from a file.
126
127       -x  Do not cross filesystem boundaries, i.e. only count files and
128           directories on the same filesystem as the directory being scanned.
129
130       --exclude PATTERN
131           Exclude files that match PATTERN. The files will still be displayed
132           by default, but are not counted towards the disk usage statistics.
133           This argument can be added multiple times to add more patterns.
134
135       -X FILE, --exclude-from FILE
136           Exclude files that match any pattern in FILE. Patterns should be
137           separated by a newline.
138
139       --exclude-caches
140           Exclude directories containing CACHEDIR.TAG.  The directories will
141           still be displayed, but not their content, and they are not counted
142           towards the disk usage statistics.  See
143           http://www.brynosaurus.com/cachedir/
144
145       -L, --follow-symlinks
146           Follow symlinks and count the size of the file they point to. As of
147           ncdu 1.14, this option will not follow symlinks to directories and
148           will count each symlinked file as a unique file (i.e. unlike how
149           hard links are handled). This is subject to change in later
150           versions.
151
152       --exclude-firmlinks
153           (MacOS only) Exclude firmlinks.
154
155       --exclude-kernfs
156           (Linux only) Exclude Linux pseudo filesystems, e.g. /proc (procfs),
157           /sys (sysfs).
158
159           The complete list of currently known pseudo filesystems is: binfmt,
160           bpf, cgroup, cgroup2, debug, devpts, proc, pstore, security,
161           selinux, sys, trace.
162

KEYS

164       ?   Show help + keys + about screen
165
166       up, down, j, k
167           Cycle through the items
168
169       right, enter, l
170           Open selected directory
171
172       left, <, h
173           Go to parent directory
174
175       n   Order by filename (press again for descending order)
176
177       s   Order by filesize (press again for descending order)
178
179       C   Order by number of items (press again for descending order)
180
181       a   Toggle between showing disk usage and showing apparent size.
182
183       M   Order by latest child mtime, or modified time. (press again for
184           descending order) Requires the -e flag.
185
186       d   Delete the selected file or directory. An error message will be
187           shown when the contents of the directory do not match or do not
188           exist anymore on the filesystem.
189
190       t   Toggle dirs before files when sorting.
191
192       g   Toggle between showing percentage, graph, both, or none. Percentage
193           is relative to the size of the current directory, graph is relative
194           to the largest item in the current directory.
195
196       c   Toggle display of child item counts.
197
198       m   Toggle display of latest child mtime, or modified time. Requires
199           the -e flag.
200
201       e   Show/hide 'hidden' or 'excluded' files and directories. Please note
202           that even though you can't see the hidden files and directories,
203           they are still there and they are still included in the directory
204           sizes. If you suspect that the totals shown at the bottom of the
205           screen are not correct, make sure you haven't enabled this option.
206
207       i   Show information about the current selected item.
208
209       r   Refresh/recalculate the current directory.
210
211       b   Spawn shell in current directory.
212
213           Ncdu will determine your preferred shell from the "NCDU_SHELL" or
214           "SHELL" variable (in that order), or will call "/bin/sh" if neither
215           are set.  This allows you to also configure another command to be
216           run when he 'b' key is pressed. For example, to spawn the vifm(1)
217           file manager instead of a shell, run ncdu as follows:
218
219             export NCDU_SHELL=vifm
220             ncdu
221
222           Ncdu will set the "NCDU_LEVEL" environment variable or increment it
223           before spawning the shell. This variable allows you to detect when
224           your shell is running from within ncdu, which can be useful to
225           avoid nesting multiple instances of ncdu. Ncdu itself does not
226           (currently) warn when attempting to run nested instances.
227
228       q   Quit
229

FILE FLAGS

231       Entries in the browser interface may be prefixed by a one-character
232       flag. These flags have the following meaning:
233
234       !   An error occurred while reading this directory.
235
236       .   An error occurred while reading a subdirectory, so the indicated
237           size may not be correct.
238
239       <   File or directory is excluded from the statistics by using exclude
240           patterns.
241
242       >   Directory is on another filesystem.
243
244       ^   Directory is excluded from the statistics due to being a Linux
245           pseudo filesystem.
246
247       @   This is neither a file nor a folder (symlink, socket, ...).
248
249       H   Same file was already counted (hard link).
250
251       e   Empty directory.
252

EXAMPLES

254       To scan and browse the directory you're currently in, all you need is a
255       simple:
256
257         ncdu
258
259       If you want to scan a full filesystem, your root filesystem, for
260       example, then you'll want to use "-x":
261
262         ncdu -x /
263
264       Since scanning a large directory may take a while, you can scan a
265       directory and export the results for later viewing:
266
267         ncdu -1xo- / | gzip >export.gz
268         # ...some time later:
269         zcat export.gz | ncdu -f-
270
271       To export from a cron job, make sure to replace "-1" with "-0" to
272       suppress any unnecessary output.
273
274       You can also export a directory and browse it once scanning is done:
275
276         ncdu -o- | tee export.file | ./ncdu -f-
277
278       The same is possible with gzip compression, but is a bit kludgey:
279
280         ncdu -o- | gzip | tee export.gz | gunzip | ./ncdu -f-
281
282       To scan a system remotely, but browse through the files locally:
283
284         ssh -C user@system ncdu -o- / | ./ncdu -f-
285
286       The "-C" option to ssh enables compression, which will be very useful
287       over slow links. Remote scanning and local viewing has two major
288       advantages when compared to running ncdu directly on the remote system:
289       You can browse through the scanned directory on the local system
290       without any network latency, and ncdu does not keep the entire
291       directory structure in memory when exporting, so you won't consume much
292       memory on the remote system.
293
295       Every disk usage analysis utility has its own way of (not) counting
296       hard links.  There does not seem to be any universally agreed method of
297       handling hard links, and it is even inconsistent among different
298       versions of ncdu. This section explains what each version of ncdu does.
299
300       ncdu 1.5 and below does not support any hard link detection at all:
301       each link is considered a separate inode and its size is counted for
302       every link. This means that the displayed directory sizes are incorrect
303       when analyzing directories which contain hard links.
304
305       ncdu 1.6 has basic hard link detection: When a link to a previously
306       encountered inode is detected, the link is considered to have a file
307       size of zero bytes.  Its size is not counted again, and the link is
308       indicated in the browser interface with a 'H' mark. The displayed
309       directory sizes are only correct when all links to an inode reside
310       within that directory. When this is not the case, the sizes may or may
311       not be correct, depending on which links were considered as "duplicate"
312       and which as "original". The indicated size of the topmost directory
313       (that is, the one specified on the command line upon starting ncdu) is
314       always correct.
315
316       ncdu 1.7 and later has improved hard link detection. Each file that has
317       more than two links has the "H" mark visible in the browser interface.
318       Each hard link is counted exactly once for every directory it appears
319       in. The indicated size of each directory is therefore, correctly, the
320       sum of the sizes of all unique inodes that can be found in that
321       directory. Note, however, that this may not always be same as the space
322       that will be reclaimed after deleting the directory, as some inodes may
323       still be accessible from hard links outside it.
324

BUGS

326       Directory hard links are not supported. They will not be detected as
327       being hard links, and will thus be scanned and counted multiple times.
328
329       Some minor glitches may appear when displaying filenames that contain
330       multibyte or multicolumn characters.
331
332       All sizes are internally represented as a signed 64bit integer. If you
333       have a directory larger than 8 EiB minus one byte, ncdu will clip its
334       size to 8 EiB minus one byte. When deleting items in a directory with a
335       clipped size, the resulting sizes will be incorrect.
336
337       Item counts are stored in a signed 32-bit integer without overflow
338       detection.  If you have a directory with more than 2 billion files,
339       quite literally anything can happen.
340
341       On macOS 10.15 and later, running ncdu on the root directory without
342       `--exclude-firmlinks` may cause directories to be scanned and counted
343       multiple times. Firmlink cycles are currently (1.16) not detected, so
344       it may also cause ncdu to get stuck in an infinite loop and eventually
345       run out of memory.
346
347       Please report any other bugs you may find at the bug tracker, which can
348       be found on the web site at https://dev.yorhel.nl/ncdu
349

AUTHOR

351       Written by Yoran Heling <projects@yorhel.nl>.
352

SEE ALSO

354       du(1)
355
356
357
358ncdu-1.16                         2021-10-07                           NCDU(1)
Impressum