11.\" SPDX-FileCopyrightText: Yorhel <[email protected] >22.\" SPDX-License-Identifier: MIT
3- .Dd April 20 , 2024
3+ .Dd September 27 , 2024
44.Dt NCDU 1
55.Os
66.Sh NAME
77.Nm ncdu
88.Nd NCurses Disk Usage
9+ .
910.Sh SYNOPSIS
1011.Nm
1112.Op Fl f Ar file
1213.Op Fl o Ar file
14+ .Op Fl O Ar file
1315.Op Fl e , \- extended , \- no \- extended
1416.Op Fl \- ignore \- config
1517.Op Fl x , \- one \- file \- system , \- cross \- file \- system
1820.Op Fl \- include \- caches , \- exclude \- caches
1921.Op Fl L , \- follow \- symlinks , \- no \- follow \- symlinks
2022.Op Fl \- include \- kernfs , \- exclude \- kernfs
23+ .Op Fl t , \- threads Ar num
24+ .Op Fl \- compress \- level Ar num
2125.Op Fl 0 , 1 , 2
2226.Op Fl q , \- slow \- ui \- updates , \- fast \- ui \- updates
2327.Op Fl \- enable \- shell , \- disable \- shell
4448.Op Fl h , \- help
4549.Nm
4650.Op Fl v , V , \- version
51+ .
4752.Sh DESCRIPTION
4853.Nm
4954(NCurses Disk Usage) is an interactive curses-based version of the well-known
5055.Xr du 1 ,
5156and provides a fast way to see what directories are using your disk space.
57+ .
5258.Sh OPTIONS
5359.Ss Mode Selection
5460.Bl -tag -width Ds
@@ -59,10 +65,13 @@ Print version and quit.
5965.It Fl f Ar file
6066Load the given file, which has earlier been created with the
6167.Fl o
68+ or
69+ .Fl O
6270flag.
6371If
6472.Ar file
6573is equivalent to '\- ', the file is read from standard input.
74+ Reading from standard input is only supported for the JSON format.
6675.Pp
6776For the sake of preventing a screw-up, the current version of
6877.Nm
@@ -73,7 +82,7 @@ will be disabled.
7382.It Ar dir
7483Scan the given directory.
7584.It Fl o Ar file
76- Export all necessary information to
85+ Export the directory tree in JSON format to
7786.Ar file
7887instead of opening the browser interface.
7988If
@@ -87,6 +96,22 @@ directory with many files.
8796uncompressed, or a little over 100 KiB when compressed with gzip.
8897This scales linearly, so be prepared to handle a few tens of megabytes when
8998dealing with millions of files.
99+ .Pp
100+ When running a multi-threaded scan or when scanning a directory tree that may
101+ not fit in memory, consider using
102+ .Fl O
103+ instead.
104+ .It Fl O Ar file
105+ Export the directory tree in binary format to
106+ .Ar file
107+ instead of opening the browser interface.
108+ If
109+ .Ar file
110+ is '\- ', the data is written to standard output.
111+ The binary format has built-in compression, supports low-memory multi-threaded
112+ export (in combination with
113+ .Fl t )
114+ and can be browsed without importing the entire directory tree into memory.
90115.It Fl e , \- extended , \- no \- extended
91116Enable/disable extended information mode.
92117This will, in addition to the usual file information, also read the ownership,
@@ -105,6 +130,7 @@ using 'm' and 'M', respectively.
105130.It Fl \- ignore \- config
106131Do not attempt to load any configuration files.
107132.El
133+ .
108134.Ss Scan Options
109135These options affect the scanning progress, they have no effect when importing
110136directory information from a file.
@@ -147,7 +173,28 @@ The exact counting behavior of this flag is subject to change in the future.
147173.Pp
148174The complete list of currently known pseudo filesystems is: binfmt, bpf, cgroup,
149175cgroup2, debug, devpts, proc, pstore, security, selinux, sys, trace.
176+ .It Fl t , \- threads Ar num
177+ Number of threads to use when scanning the filesystem, defaults to 1.
178+ .Pp
179+ In single-threaded mode, the JSON export (see
180+ .Fl o )
181+ can operate with very little memory, but in multi-threaded mode the entire
182+ directory tree is first constructed in memory and written out after the
183+ filesystem scan has completed,
184+ This causes a delay in output and requires significantly more memory for large
185+ directory trees.
186+ The binary format (see
187+ .Fl O )
188+ does not have this problem and supports efficient exporting with any number of
189+ threads.
190+ .It Fl \- compress \- level Ar num
191+ Set the Zstandard compression level when using
192+ .Fl O
193+ to create a binary export.
194+ Valid values are 1 (fastest) to 19 (slowest).
195+ Defaults to 4.
150196.El
197+ .
151198.Ss Interface Options
152199.Bl -tag -width Ds
153200.It Fl 0
@@ -159,9 +206,8 @@ When exporting the data with
159206ncurses will not be initialized at all.
160207This option is the default when exporting to standard output.
161208.It Fl 1
162- Similar to
163- .Fl 0 ,
164- but does give feedback on the scanning progress with a single line of output.
209+ Write progress information to the terminal, but don't open a full-screen
210+ ncurses interface.
165211This option is the default when exporting to a file.
166212.Pp
167213In some cases, the ncurses browser interface which you'll see after the
@@ -297,6 +343,7 @@ color scheme that also works in terminals with a light background.
297343The default is
298344.Ar off .
299345.El
346+ .
300347.Sh CONFIGURATION
301348.Nm
302349can be configured by placing command-line options in
@@ -325,6 +372,7 @@ Example configuration file:
325372# Exclude .git directories
326373\-\- exclude .git
327374.Ed
375+ .
328376.Sh KEYS
329377.Bl -tag -width Ds
330378.It ?
@@ -411,6 +459,7 @@ itself does not (currently) warn about or prevent this situation.
411459.It q
412460Quit
413461.El
462+ .
414463.Sh FILE FLAGS
415464Entries in the browser interface may be prefixed by a one\- character flag.
416465These flags have the following meaning:
@@ -434,6 +483,7 @@ Same file was already counted (hard link).
434483.It e
435484Empty directory.
436485.El
486+ .
437487.Sh EXAMPLES
438488To scan and browse the directory you're currently in, all you need is a simple:
439489.Dl ncdu
@@ -473,20 +523,23 @@ the local system without any network latency, and
473523.Nm
474524does not keep the entire directory structure in memory when exporting, so this
475525won't consume much memory on the remote system.
526+ .
476527.Sh SEE ALSO
477528.Xr du 1 ,
478529.Xr tree 1 .
479530.Pp
480531.Nm
481532has a website:
482533.Lk https://dev.yorhel.nl/ncdu
534+ .
483535.Sh AUTHORS
484536Written by
485537.
An Yorhel Aq Mt [email protected] 538+ .
486539.Sh BUGS
487540Directory hard links and firmlinks (MacOS) are not supported.
488- They are not detected as being hard links, and will thus get scanned and
489- counted multiple times.
541+ They are not detected as being hard links and will thus get scanned and counted
542+ multiple times.
490543.Pp
491544Some minor glitches may appear when displaying filenames that contain multibyte
492545or multicolumn characters.
0 commit comments