1NCDU(1) ncdu manual NCDU(1)
2
3
4
6 ncdu - NCurses Disk Usage
7
9 ncdu [options] dir
10
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
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. Currently only two schemes are recognized:
116 off to disable colors (the default) and dark for a color scheme
117 intended for dark backgrounds.
118
119 Scan Options
120 These options affect the scanning progress, and have no effect when
121 importing directory information from a file.
122
123 -x Do not cross filesystem boundaries, i.e. only count files and
124 directories on the same filesystem as the directory being scanned.
125
126 --exclude PATTERN
127 Exclude files that match PATTERN. The files will still be displayed
128 by default, but are not counted towards the disk usage statistics.
129 This argument can be added multiple times to add more patterns.
130
131 -X FILE, --exclude-from FILE
132 Exclude files that match any pattern in FILE. Patterns should be
133 separated by a newline.
134
135 --exclude-caches
136 Exclude directories containing CACHEDIR.TAG. The directories will
137 still be displayed, but not their content, and they are not counted
138 towards the disk usage statistics. See
139 http://www.brynosaurus.com/cachedir/
140
141 -L, --follow-symlinks
142 Follow symlinks and count the size of the file they point to. As of
143 ncdu 1.14, this option will not follow symlinks to directories and
144 will count each symlinked file as a unique file (i.e. unlike how
145 hard links are handled). This is subject to change in later
146 versions.
147
149 ? Show help + keys + about screen
150
151 up, down j, k
152 Cycle through the items
153
154 right, enter, l
155 Open selected directory
156
157 left, <, h
158 Go to parent directory
159
160 n Order by filename (press again for descending order)
161
162 s Order by filesize (press again for descending order)
163
164 C Order by number of items (press again for descending order)
165
166 a Toggle between showing disk usage and showing apparent size.
167
168 M Order by latest child mtime, or modified time. (press again for
169 descending order) Requires the -e flag.
170
171 d Delete the selected file or directory. An error message will be
172 shown when the contents of the directory do not match or do not
173 exist anymore on the filesystem.
174
175 t Toggle dirs before files when sorting.
176
177 g Toggle between showing percentage, graph, both, or none. Percentage
178 is relative to the size of the current directory, graph is relative
179 to the largest item in the current directory.
180
181 c Toggle display of child item counts.
182
183 m Toggle display of latest child mtime, or modified time. Requires
184 the -e flag.
185
186 e Show/hide 'hidden' or 'excluded' files and directories. Please note
187 that even though you can't see the hidden files and directories,
188 they are still there and they are still included in the directory
189 sizes. If you suspect that the totals shown at the bottom of the
190 screen are not correct, make sure you haven't enabled this option.
191
192 i Show information about the current selected item.
193
194 r Refresh/recalculate the current directory.
195
196 b Spawn shell in current directory.
197
198 Ncdu will determine your preferred shell from the "NCDU_SHELL" or
199 "SHELL" variable (in that order), or will call "/bin/sh" if neither
200 are set. This allows you to also configure another command to be
201 run when he 'b' key is pressed. For example, to spawn the vifm(1)
202 file manager instead of a shell, run ncdu as follows:
203
204 export NCDU_SHELL=vifm
205 ncdu
206
207 q Quit
208
210 Entries in the browser interface may be prefixed by a one-character
211 flag. These flags have the following meaning:
212
213 ! An error occurred while reading this directory.
214
215 . An error occurred while reading a subdirectory, so the indicated
216 size may not be correct.
217
218 < File or directory is excluded from the statistics by using exlude
219 patterns.
220
221 > Directory is on another filesystem.
222
223 @ This is neither a file nor a folder (symlink, socket, ...).
224
225 H Same file was already counted (hard link).
226
227 e Empty directory.
228
230 To scan and browse the directory you're currently in, all you need is a
231 simple:
232
233 ncdu
234
235 If you want to scan a full filesystem, your root filesystem, for
236 example, then you'll want to use "-x":
237
238 ncdu -x /
239
240 Since scanning a large directory may take a while, you can scan a
241 directory and export the results for later viewing:
242
243 ncdu -1xo- / | gzip >export.gz
244 # ...some time later:
245 zcat export.gz | ncdu -f-
246
247 To export from a cron job, make sure to replace "-1" with "-0" to
248 suppress any unnecessary output.
249
250 You can also export a directory and browse it once scanning is done:
251
252 ncdu -o- | tee export.file | ./ncdu -f-
253
254 The same is possible with gzip compression, but is a bit kludgey:
255
256 ncdu -o- | gzip | tee export.gz | gunzip | ./ncdu -f-
257
258 To scan a system remotely, but browse through the files locally:
259
260 ssh -C user@system ncdu -o- / | ./ncdu -f-
261
262 The "-C" option to ssh enables compression, which will be very useful
263 over slow links. Remote scanning and local viewing has two major
264 advantages when compared to running ncdu directly on the remote system:
265 You can browse through the scanned directory on the local system
266 without any network latency, and ncdu does not keep the entire
267 directory structure in memory when exporting, so you won't consume much
268 memory on the remote system.
269
271 Every disk usage analysis utility has its own way of (not) counting
272 hard links. There does not seem to be any universally agreed method of
273 handling hard links, and it is even inconsistent among different
274 versions of ncdu. This section explains what each version of ncdu does.
275
276 ncdu 1.5 and below does not support any hard link detection at all:
277 each link is considered a separate inode and its size is counted for
278 every link. This means that the displayed directory sizes are incorrect
279 when analyzing directories which contain hard links.
280
281 ncdu 1.6 has basic hard link detection: When a link to a previously
282 encountered inode is detected, the link is considered to have a file
283 size of zero bytes. Its size is not counted again, and the link is
284 indicated in the browser interface with a 'H' mark. The displayed
285 directory sizes are only correct when all links to an inode reside
286 within that directory. When this is not the case, the sizes may or may
287 not be correct, depending on which links were considered as "duplicate"
288 and which as "original". The indicated size of the topmost directory
289 (that is, the one specified on the command line upon starting ncdu) is
290 always correct.
291
292 ncdu 1.7 and later has improved hard link detection. Each file that has
293 more than two links has the "H" mark visible in the browser interface.
294 Each hard link is counted exactly once for every directory it appears
295 in. The indicated size of each directory is therefore, correctly, the
296 sum of the sizes of all unique inodes that can be found in that
297 directory. Note, however, that this may not always be same as the space
298 that will be reclaimed after deleting the directory, as some inodes may
299 still be accessible from hard links outside it.
300
302 Directory hard links are not supported. They will not be detected as
303 being hard links, and will thus be scanned and counted multiple times.
304
305 Some minor glitches may appear when displaying filenames that contain
306 multibyte or multicolumn characters.
307
308 All sizes are internally represented as a signed 64bit integer. If you
309 have a directory larger than 8 EiB minus one byte, ncdu will clip its
310 size to 8 EiB minus one byte. When deleting items in a directory with a
311 clipped size, the resulting sizes will be incorrect.
312
313 Item counts are stored in a signed 32-bit integer without overflow
314 detection. If you have a directory with more than 2 billion files,
315 quite literally anything can happen.
316
317 Please report any other bugs you may find at the bug tracker, which can
318 be found on the web site at https://dev.yorhel.nl/ncdu
319
321 Written by Yoran Heling <projects@yorhel.nl>.
322
324 du(1)
325
326
327
328ncdu-1.14 2019-01-24 NCDU(1)