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, --extended, --no-extended
50           Enable/disable extended information mode. This will, in addition to
51           the usual file information, also read the ownership, permissions
52           and last modification time for each file. This will result in
53           higher memory usage (by roughly ~30%) and in a larger output file
54           when exporting.
55
56           When using the file export/import function, this flag will need to
57           be added both when exporting (to make sure the information is added
58           to the export), and when importing (to read this extra information
59           in memory). This flag has no effect when importing a file that has
60           been exported without the extended information.
61
62           This enables viewing and sorting by the latest child mtime, or
63           modified time, using 'm' and 'M', respectively.
64
65       --ignore-config
66           Do not attempt to load any configuration files.
67
68   Scan Options
69       These options affect the scanning progress, and have no effect when
70       importing directory information from a file.
71
72       -x, --one-file-system
73           Do not cross filesystem boundaries, i.e. only count files and
74           directories on the same filesystem as the directory being scanned.
75
76       --cross-file-system
77           Do cross filesystem boundaries. This is the default, but can be
78           specified to overrule a previously given "-x".
79
80       --exclude PATTERN
81           Exclude files that match PATTERN. The files will still be displayed
82           by default, but are not counted towards the disk usage statistics.
83           This argument can be added multiple times to add more patterns.
84
85       -X FILE, --exclude-from FILE
86           Exclude files that match any pattern in FILE. Patterns should be
87           separated by a newline.
88
89       --include-caches, --exclude-caches
90           Include (default) or exclude directories containing CACHEDIR.TAG.
91           The directories will still be displayed, but their contents will
92           not be scanned or counted towards the disk usage statistics.
93           <http://www.brynosaurus.com/cachedir/>
94
95       -L, --follow-symlinks, --no-follow-symlinks
96           Follow (or not) symlinks and count the size of the file they point
97           to. As of ncdu 1.14, this option will not follow symlinks to
98           directories and will count each symlinked file as a unique file
99           (i.e. unlike how hard links are handled).  This is subject to
100           change in later versions.
101
102       --exclude-firmlinks, --follow-firmlinks
103           (MacOS only) Exclude or follow firmlinks.
104
105       --include-kernfs, --exclude-kernfs
106           (Linux only) Include (default) or exclude Linux pseudo filesystems,
107           e.g. /proc (procfs), /sys (sysfs).
108
109           The complete list of currently known pseudo filesystems is: binfmt,
110           bpf, cgroup, cgroup2, debug, devpts, proc, pstore, security,
111           selinux, sys, trace.
112
113   Interface options
114       -0  Don't give any feedback while scanning a directory or importing a
115           file, other than when a fatal error occurs. Ncurses will not be
116           initialized until the scan is complete. When exporting the data
117           with "-o", ncurses will not be initialized at all. This option is
118           the default when exporting to standard output.
119
120       -1  Similar to "-0", but does give feedback on the scanning progress
121           with a single line of output. This option is the default when
122           exporting to a file.
123
124           In some cases, the ncurses browser interface which you'll see after
125           the scan/import is complete may look garbled when using this
126           option. If you're not exporting to a file, "-2" is probably a
127           better choice.
128
129       -2  Provide a full-screen ncurses interface while scanning a directory
130           or importing a file. This is the only interface that provides
131           feedback on any non-fatal errors while scanning.
132
133       -q, --slow-ui-updates, --fast-ui-updates
134           Change the UI update interval while scanning or importing. Ncdu
135           will update the screen 10 times a second by default
136           ("--fast-ui-updates"), this can be decreased to once every 2
137           seconds with "-q" or "--slow-ui-updates". This feature can be used
138           to save bandwidth over remote connections. This option has no
139           effect when "-0" is used.
140
141       --enable-shell, --disable-shell
142           Enable or disable shell spawning from the browser. This feature is
143           enabled by default when scanning a live directory and disabled when
144           importing from file.
145
146       --enable-delete, --disable-delete
147           Enable or disable the built-in file deletion feature. This feature
148           is enabled by default when scanning a live directory and disabled
149           when importing from file. Explicitly disabling the deletion feature
150           can work as a safeguard to prevent accidental data loss.
151
152       --enable-refresh, --disable-refresh
153           Enable or disable directory refreshing from the browser. This
154           feature is enabled by default when scanning a live directory and
155           disabled when importing from file.
156
157       -r  Read-only mode. When given once, this is an alias for
158           "--disable-delete", when given twice it will also add
159           "--disable-shell", thus ensuring that there is no way to modify the
160           file system from within ncdu.
161
162       --si, --no-si
163           List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB,
164           etc), as defined in the International System of Units (SI), instead
165           of the usual base 2 prefixes, that is, powers of 1024 (KiB, MiB,
166           etc).
167
168       --disk-usage, --apparent-size
169           Select whether to display disk usage (default) or apparent sizes.
170           Can also be toggled in the browser with the 'a' key.
171
172       --show-hidden, --hide-hidden
173           Show (default) or hide "hidden" and excluded files. Can also be
174           toggled in the browser with the 'e' key.
175
176       --show-itemcount, --hide-itemcount
177           Show or hide (default) the item counts column. Can also be toggled
178           in the browser with the 'c' key.
179
180       --show-mtime, --hide-mtime
181           Show or hide (default) the last modification time column. Can also
182           be toggled in the browser with the 'm' key. This option is ignored
183           when not in extended mode (see "-e").
184
185       --show-graph, --hide-graph
186           Show (default) or hide the relative size bar column. Can also be
187           toggled in the browser with the 'g' key.
188
189       --show-percent, --hide-percent
190           Show (default) or hide the relative size percent column. Can also
191           be toggled in the browser with the 'g' key.
192
193       --sort COLUMN
194           Change the default column to sort on. Accepted values are disk-
195           usage (the default), name, apparent-size, itemcount or mtime. The
196           latter only makes sense in extended mode, see "-e".
197
198           The column can be suffixed with -asc or -desc to set the order to
199           ascending or descending, respectively. e.g. "--sort=name-desc" will
200           sort by name in descending order.
201
202       --group-directories-first, --no-group-directories-first
203           Sort (or not) directories before files.
204
205       --confirm-quit, --no-confirm-quit
206           Require a confirmation before quitting ncdu. Very helpful when you
207           accidentally press 'q' during or after a very long scan.
208
209       --confirm-delete, --no-confirm-delete
210           Require a confirmation before deleting a file or directory. Enabled
211           by default, but can be disabled if you're absolutely sure you won't
212           accidentally press 'd'.
213
214       --color SCHEME
215           Select a color scheme. The following schemes are recognized: off to
216           disable colors, dark for a color scheme intended for dark
217           backgrounds and dark-bg for a variation of the dark color scheme
218           that also works in terminals with a light background.
219
220           The default is dark-bg unless the "NO_COLOR" environment variable
221           is set.
222

CONFIGURATION

224       Ncdu can be configured by placing command-line options in
225       "/etc/ncdu.conf" or "$HOME/.config/ncdu/config". If both files exist,
226       the system configuration will be loaded before the user configuration,
227       allowing users to override options set in the system configuration.
228       Options given on the command line will override options set in the
229       configuration files. The files will not be read at all when
230       "--ignore-config" is given on the command line.
231
232       The configuration file format is simply one command line option per
233       line. Lines starting with "#" are ignored. Example configuration file:
234
235         # Always enable extended mode
236         -e
237
238         # Disable file deletion
239         --disable-delete
240
241         # Exclude .git directories
242         --exclude .git
243

KEYS

245       ?   Show help + keys + about screen
246
247       up, down, j, k
248           Cycle through the items
249
250       right, enter, l
251           Open selected directory
252
253       left, <, h
254           Go to parent directory
255
256       n   Order by filename (press again for descending order)
257
258       s   Order by filesize (press again for descending order)
259
260       C   Order by number of items (press again for descending order)
261
262       a   Toggle between showing disk usage and showing apparent size.
263
264       M   Order by latest child mtime, or modified time. (press again for
265           descending order) Requires the -e flag.
266
267       d   Delete the selected file or directory. An error message will be
268           shown when the contents of the directory do not match or do not
269           exist anymore on the filesystem.
270
271       t   Toggle dirs before files when sorting.
272
273       g   Toggle between showing percentage, graph, both, or none. Percentage
274           is relative to the size of the current directory, graph is relative
275           to the largest item in the current directory.
276
277       c   Toggle display of child item counts.
278
279       m   Toggle display of latest child mtime, or modified time. Requires
280           the -e flag.
281
282       e   Show/hide 'hidden' or 'excluded' files and directories. Please note
283           that even though you can't see the hidden files and directories,
284           they are still there and they are still included in the directory
285           sizes. If you suspect that the totals shown at the bottom of the
286           screen are not correct, make sure you haven't enabled this option.
287
288       i   Show information about the current selected item.
289
290       r   Refresh/recalculate the current directory.
291
292       b   Spawn shell in current directory.
293
294           Ncdu will determine your preferred shell from the "NCDU_SHELL" or
295           "SHELL" variable (in that order), or will call "/bin/sh" if neither
296           are set.  This allows you to also configure another command to be
297           run when he 'b' key is pressed. For example, to spawn the vifm(1)
298           file manager instead of a shell, run ncdu as follows:
299
300             export NCDU_SHELL=vifm
301             ncdu
302
303           Ncdu will set the "NCDU_LEVEL" environment variable or increment it
304           before spawning the shell. This variable allows you to detect when
305           your shell is running from within ncdu, which can be useful to
306           avoid nesting multiple instances of ncdu. Ncdu itself does not
307           (currently) warn when attempting to run nested instances.
308
309       q   Quit
310

FILE FLAGS

312       Entries in the browser interface may be prefixed by a one-character
313       flag. These flags have the following meaning:
314
315       !   An error occurred while reading this directory.
316
317       .   An error occurred while reading a subdirectory, so the indicated
318           size may not be correct.
319
320       <   File or directory is excluded from the statistics by using exclude
321           patterns.
322
323       >   Directory is on another filesystem.
324
325       ^   Directory is excluded from the statistics due to being a Linux
326           pseudo filesystem.
327
328       @   This is neither a file nor a folder (symlink, socket, ...).
329
330       H   Same file was already counted (hard link).
331
332       e   Empty directory.
333

EXAMPLES

335       To scan and browse the directory you're currently in, all you need is a
336       simple:
337
338         ncdu
339
340       If you want to scan a full filesystem, your root filesystem, for
341       example, then you'll want to use "-x":
342
343         ncdu -x /
344
345       Since scanning a large directory may take a while, you can scan a
346       directory and export the results for later viewing:
347
348         ncdu -1xo- / | gzip >export.gz
349         # ...some time later:
350         zcat export.gz | ncdu -f-
351
352       To export from a cron job, make sure to replace "-1" with "-0" to
353       suppress any unnecessary output.
354
355       You can also export a directory and browse it once scanning is done:
356
357         ncdu -o- | tee export.file | ./ncdu -f-
358
359       The same is possible with gzip compression, but is a bit kludgey:
360
361         ncdu -o- | gzip | tee export.gz | gunzip | ./ncdu -f-
362
363       To scan a system remotely, but browse through the files locally:
364
365         ssh -C user@system ncdu -o- / | ./ncdu -f-
366
367       The "-C" option to ssh enables compression, which will be very useful
368       over slow links. Remote scanning and local viewing has two major
369       advantages when compared to running ncdu directly on the remote system:
370       You can browse through the scanned directory on the local system
371       without any network latency, and ncdu does not keep the entire
372       directory structure in memory when exporting, so you won't consume much
373       memory on the remote system.
374
376       Every disk usage analysis utility has its own way of (not) counting
377       hard links.  There does not seem to be any universally agreed method of
378       handling hard links, and it is even inconsistent among different
379       versions of ncdu. This section explains what each version of ncdu does.
380
381       ncdu 1.5 and below does not support any hard link detection at all:
382       each link is considered a separate inode and its size is counted for
383       every link. This means that the displayed directory sizes are incorrect
384       when analyzing directories which contain hard links.
385
386       ncdu 1.6 has basic hard link detection: When a link to a previously
387       encountered inode is detected, the link is considered to have a file
388       size of zero bytes.  Its size is not counted again, and the link is
389       indicated in the browser interface with a 'H' mark. The displayed
390       directory sizes are only correct when all links to an inode reside
391       within that directory. When this is not the case, the sizes may or may
392       not be correct, depending on which links were considered as "duplicate"
393       and which as "original". The indicated size of the topmost directory
394       (that is, the one specified on the command line upon starting ncdu) is
395       always correct.
396
397       ncdu 1.7 and later has improved hard link detection. Each file that has
398       more than two links has the "H" mark visible in the browser interface.
399       Each hard link is counted exactly once for every directory it appears
400       in. The indicated size of each directory is therefore, correctly, the
401       sum of the sizes of all unique inodes that can be found in that
402       directory. Note, however, that this may not always be same as the space
403       that will be reclaimed after deleting the directory, as some inodes may
404       still be accessible from hard links outside it.
405

BUGS

407       Directory hard links are not supported. They will not be detected as
408       being hard links, and will thus be scanned and counted multiple times.
409
410       Some minor glitches may appear when displaying filenames that contain
411       multibyte or multicolumn characters.
412
413       All sizes are internally represented as a signed 64bit integer. If you
414       have a directory larger than 8 EiB minus one byte, ncdu will clip its
415       size to 8 EiB minus one byte. When deleting items in a directory with a
416       clipped size, the resulting sizes will be incorrect.
417
418       Item counts are stored in a signed 32-bit integer without overflow
419       detection.  If you have a directory with more than 2 billion files,
420       quite literally anything can happen.
421
422       On macOS 10.15 and later, running ncdu on the root directory without
423       `--exclude-firmlinks` may cause directories to be scanned and counted
424       multiple times. Firmlink cycles are currently (1.16) not detected, so
425       it may also cause ncdu to get stuck in an infinite loop and eventually
426       run out of memory.
427
428       Please report any other bugs you may find at the bug tracker, which can
429       be found on the web site at https://dev.yorhel.nl/ncdu
430

AUTHOR

432       Written by Yoran Heling <projects@yorhel.nl>.
433

SEE ALSO

435       du(1)
436
437
438
439ncdu-1.18                         2022-11-30                           NCDU(1)
Impressum