NCDU(1)

๐Ÿ’– NCDU ๐Ÿ’– โ€” the NCDU(1) girlie manual

okay so this is NCDU(1), straight outta the General Commands Manual, and bestie it's giving essential. we're gonna walk through every single flag together, no skips, no skimming, periodt. ๐Ÿฆ‹


โœจ NAME โœจ

ncdu โ€” NCurses Disk Usage. that's it, that's the name, iconic. ๐Ÿ’…


โœจ SYNOPSIS โœจ

ncdu [-f file] [-o 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] [-t, --threads num]
     [-c, --compress, --no-compress] [--compress-level num]
     [--export-block-size num] [-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]
     [--graph-style hash | half-block | eighth-block]
     [--shared-column off | shared | unique] [--sort column]
     [--enable-natsort, --disable-natsort]
     [--group-directories-first, --no-group-directories-first]
     [--confirm-quit, --no-confirm-quit]
     [--confirm-delete, --no-confirm-delete] [--delete-command command]
     [--color off | dark | dark-bg] [path]
ncdu [-h, --help]
ncdu [-v, -V, --version]

look at all those options, we're gonna get through all of them, one by one, like the devoted besties we are ๐ŸŒธ


โœจ DESCRIPTION โœจ

ncdu (that's NCurses Disk Usage, obviously) is an interactive curses-based version of the well-known du(1), and it gives you a fast way to see what directories are eating your disk space. no cap. it's literally the glow-up du deserved. ๐Ÿ‘‘


โœจ OPTIONS โœจ

๐ŸŽ€ Mode Selection ๐ŸŽ€

  • -h, --help โ€” prints a short lil help message and dips. that's it, that's the whole job. ๐Ÿซถ
  • -v, -V, --version โ€” prints the version and bounces. three whole ways to say "who am i". slay.
  • -f file โ€” loads the given file, which was earlier created with the -o or -O flag. and if file is equivalent to -, the file gets read from standard input โ€” but bestie, listen, reading from standard input is only supported for the JSON format. ๐Ÿ’€
and for the sake of preventing a screw-up, the current version of ncdu assumes that the directory information in the imported file does not represent the filesystem on which the file is being imported. which means: the refresh, file deletion and shell spawning options in the browser are all disabled. it's a safety thing, we love a cautious queen. ๐ŸŽ€
  • dir โ€” scans the given directory. the classic. the main character move. ๐ŸŒŸ
  • -o file โ€” exports the directory tree in JSON format to file instead of opening the browser interface. if file is -, the data goes to standard output. (peep the examples section further down for some handy use cases, iykyk.) โœจ
โš ๏ธ be warned bestie: the exported data can get HUGE when you're exporting a directory with many files. like, 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 you're dealing with millions of files. no one is coming to save you. ๐Ÿ˜ญ

consider enabling -c to output Zstandard-compressed JSON โ€” it can significantly reduce the size of the exported data. ๐Ÿ’…

and when you're running a multi-threaded scan, or scanning a directory tree that may not fit in memory, consider using -O instead. ๐Ÿงš

  • -O file โ€” exports the directory tree in binary format to file instead of opening the browser interface. if file is -, the data is written to standard output. the binary format has built-in compression, supports low-memory multi-threaded export (in combination with -t) and can be browsed without importing the entire directory tree into memory. it's giving efficiency, it's giving forethought. ๐Ÿ”ฅ
  • -e, --extended, --no-extended โ€” enable/disable extended information mode. this reads the usual file info plus the ownership, permissions and last modification time for each file. the cost? higher memory usage (by roughly ~30%) and a larger output file when exporting. ๐Ÿ’ธ

when using the file export/import function, this flag should be added both when exporting (so the info actually makes it into the export) and when importing (so it gets read into memory). this flag has no effect when importing a file that was exported without the extended information. ๐Ÿ™ˆ

also: this is what unlocks viewing and sorting by the latest child mtime, or modified time, using m and M, respectively. ๐Ÿ’–

  • --ignore-config โ€” do not attempt to load any configuration files. we're going rogue, we're raw-dogging the defaults. ๐ŸŒˆ

๐Ÿ” Scan Options ๐Ÿ”

these options affect the scanning progress โ€” they have no effect when importing directory information from a file. noted. ๐Ÿ“

  • -x, --one-file-system โ€” do not cross filesystem boundaries. i.e. only count files and directories on the same filesystem as the directory being scanned. stay in your lane, babe. ๐Ÿ’…
  • --cross-file-system โ€” do cross filesystem boundaries. this is the default, but you can specify it to overrule a previously configured -x. sometimes you gotta un-set the vibe. ๐Ÿ”„
  • --exclude pattern โ€” exclude files that match pattern. the files are still displayed by default, but they are not counted towards the disk usage statistics. this argument can be added multiple times to add more patterns. stacking them like accessories. ๐ŸŽ€
  • -X, --exclude-from file โ€” exclude files that match any pattern in file. patterns should be separated by a newline. ๐Ÿ“„
  • --include-caches, --exclude-caches โ€” include (that's the default) or exclude directories containing CACHEDIR.TAG. excluded cache directories are still displayed, but their contents will not be scanned or counted towards the disk usage statistics. (https://bford.info/cachedir/) ๐Ÿ—‚๏ธ
  • -L, --follow-symlinks, --no-follow-symlinks โ€” follow (or not) symlinks and count the size of the file they point to. heads up though: this option does not follow symlinks to directories, and it will cause each symlinked file to count as a unique file. that's different from how hard links are handled. and fr fr, the exact counting behavior of this flag is subject to change in the future. โš ๏ธ
  • --include-kernfs, --exclude-kernfs โ€” (Linux only) include (the default) or exclude Linux pseudo filesystems such as /proc (procfs) and /sys (sysfs). ๐Ÿง

the complete list of currently known pseudo filesystems is: binfmt, bpf, cgroup, cgroup2, debug, devpts, proc, pstore, security, selinux, sys, trace.

  • -t, --threads num โ€” number of threads to use when scanning the filesystem. defaults to 1. ๐Ÿงต

in single-threaded mode, the JSON export (see -o) can operate with very little memory. but in multi-threaded mode the entire directory tree is first constructed in memory and written out after the filesystem scan has completed. this causes a delay in output and requires significantly more memory for large directory trees. ๐Ÿ˜ฌ the binary format (see -O) does not have this problem and supports efficient exporting with any number of threads. periodt. ๐Ÿ’…


๐Ÿ“ค Export Options ๐Ÿ“ค

these options affect behavior when exporting to file with the -o or -O options.

  • -c, --compress, --no-compress โ€” enable or disable Zstandard compression when exporting to JSON (see -o). โœจ
  • --compress-level num โ€” set the Zstandard compression level when using -O or -c. valid values are 1 (fastest) to 19 (slowest). defaults to 4. dial it up if you've got time to burn, bestie. ๐Ÿ”ฅ
  • --export-block-size num โ€” set the block size, in kibibytes, for the binary export format (see -O). larger blocks require more memory but result in better compression efficiency. this option can be combined with a higher --compress-level for even better compression. ๐Ÿ‘‘

accepted values are between 4 and 16000. the default is to start at 64 KiB and then gradually increase the block size for large exports. ๐Ÿฆ‹


๐Ÿ–ฅ๏ธ Interface Options ๐Ÿ–ฅ๏ธ

  • -0 โ€” don't give any feedback while scanning a directory or importing a file, except when a fatal error occurs. ncurses will not be initialized until the scan is complete. and when exporting the data with -o, ncurses will not be initialized at all. this option is the default when exporting to standard output. silent. mysterious. ๐Ÿคซ
  • -1 โ€” write progress information to the terminal, but don't open a full-screen ncurses interface. this option is the default when exporting to a file. ๐Ÿ“
heads up: in some cases, the ncurses browser interface 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 โ€” show a full-screen ncurses interface while scanning a directory or importing a file. this is the only interface that provides feedback on any non-fatal errors while scanning. the full glam experience. ๐Ÿ’…
  • -q, --slow-ui-updates, --fast-ui-updates โ€” change the UI update interval while scanning or importing. ncdu updates the screen 10 times a second by default (that's with --fast-ui-updates); this can be decreased to once every 2 seconds with -q or --slow-ui-updates. use this to save bandwidth over remote connections. ๐ŸŒ this option has no effect in combination with -0.
  • --enable-shell, --disable-shell โ€” enable or disable shell spawning from the file browser. this feature is enabled by default when scanning a live directory, and disabled when importing from file. ๐Ÿš
  • --enable-delete, --disable-delete โ€” enable or disable the built-in file deletion feature. this is enabled by default when scanning a live directory and disabled when importing from file. explicitly disabling the deletion feature can work as a safeguard to prevent accidental data loss. ๐Ÿ›ก๏ธ
  • --enable-refresh, --disable-refresh โ€” enable or disable directory refreshing from the file browser. enabled by default when scanning a live directory, disabled when importing from file. ๐Ÿ”„
  • -r โ€” read-only mode. when given once, this is an alias for --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. the ultimate "look but don't touch" setting. ๐Ÿšซ
  • --si, --no-si โ€” list sizes using base 10 prefixes, that is, powers of 1000 (kB, MB, etc), as defined in the International System of Units (SI), instead of the usual base 2 prefixes (KiB, MiB, etc). metric girlies rise. ๐Ÿ“
  • --disk-usage, --apparent-size โ€” pick what you wanna see: disk usage (that's the default bestie, don't stress) or the apparent sizes. You can also flip this live in the file browser with the a key ๐Ÿ’…
  • --show-hidden, --hide-hidden โ€” show (default, we love a visible queen) or hide those "hidden" and excluded files. Toggle it in the browser with e โœจ
  • --show-itemcount, --hide-itemcount โ€” show or hide (hide is the default, soz) the item counts column. Live toggle in the browser: c ๐ŸŽ€
  • --show-mtime, --hide-mtime โ€” show or hide (again, hide is the default) the last modification time column. Browser toggle is m. Heads up: this one is ignored when you're not in extended mode, so go look at -e ๐Ÿฆ‹
  • --show-graph, --hide-graph โ€” show (default) or hide the relative size bar column. Toggle it in the browser with g ๐ŸŒธ
  • --show-percent, --hide-percent โ€” show (default) or hide the relative size percent column. Also toggled with g in the browser ๐Ÿ’–
  • --graph-style hash | half-block | eighth-block โ€” how should that relative size bar column be drawn, bestie? Recognized values: hash draws ASCII # characters (that's the default and the most portable, periodt), half-block uses half-block drawing characters, and eighth-block uses eighth-block drawing characters. Eighth-block is the most precise but ngl it may not render correctly in all terminals ๐Ÿ˜ญ
  • --shared-column off | shared | unique โ€” set it to off to kill the shared size column for directories, shared (the default) to show shared directory sizes as a separate column, or unique to show unique directory sizes as a separate column. You can also cycle through these in the file browser with the u key ๐Ÿ”ฅ
  • --sort column โ€” change the default column we sort on. Accepted values are disk-usage (the default, obvs), name, apparent-size, itemcount or mtime. The last one only makes sense in extended mode, so see -e ๐Ÿ‘‘

You can suffix the column name with -asc or -desc to change the order to ascending or descending, respectively. Like, for example, --sort=name-desc sorts by name in descending order. Slay ๐Ÿ’…

  • --enable-natsort, --disable-natsort โ€” enable (default) or disable natural sort when you're sorting by file name ๐ŸŒˆ
  • --group-directories-first, --no-group-directories-first โ€” sort (or don't) directories before files ๐Ÿซถ
  • --confirm-quit, --no-confirm-quit โ€” require a confirmation before quitting ncdu. Genuinely helpful when you accidentally press q during or after a very long scan and you have a tiny heart attack ๐Ÿ˜ญ
  • --confirm-delete, --no-confirm-delete โ€” require a confirmation before deleting a file or directory. Enabled by default, but you can turn it off if you're absolutely sure you won't accidentally press d ๐Ÿ’€
  • --delete-command command โ€” set this to a non-empty string and it replaces the built-in file deletion feature with your own custom shell command โœจ

The absolute path of the item to be deleted gets appended to the given command and the whole thing is evaluated in a shell. The command runs from the same directory that ncdu itself was started in. The NCDU_DELETE_PATH environment variable is set to the absolute path of the item to be deleted, and NCDU_LEVEL is set the same way as when you spawn a shell from within ncdu ๐Ÿš

After the command finishes, the in-memory view of the selected item is refreshed and directory sizes are adjusted as necessary. It is not a full refresh of the complete directory tree, so if the item has been renamed or moved to another directory, its new location is not automatically picked up. no cap, be aware ๐Ÿ™ˆ

Like, for example, to use rm(1) interactive mode to prompt before each deletion:

ncdu --no-confirm-delete --delete-command 'rm -ri --'

Or to move files to trash:

ncdu --delete-command 'gio trash --'
  • --color off | dark | dark-bg โ€” set the color scheme ๐ŸŽจ Recognized schemes: off disables colors, dark is a color scheme intended for dark backgrounds, and dark-bg is a variation of the dark color scheme that also works in terminals with a light background.

The default is off.


๐ŸŒธ CONFIGURATION ๐ŸŒธ

You can configure ncdu by placing command-line options in /etc/ncdu.conf or $HOME/.config/ncdu/config ๐Ÿซถ If both files exist, the system configuration gets loaded before the user configuration, which lets users override options set in the system configuration. Options given on the command line will override options set in the configuration files. And the files won't be read at all when --ignore-config is given on the command line, so there ๐Ÿ’…

The configuration file format is simply one command line option per line. Lines starting with # are ignored. A line can be prefixed with @ to suppress errors while parsing the option. Example configuration file:

# Always enable extended mode
-e

# Disable file deletion
--disable-delete

# Exclude .git directories
--exclude .git

# Read excludes from ~/.ncduexcludes, ignore error if the file does not exist
@--exclude-from ~/.ncduexcludes

โœจ KEYS โœจ

Okay bestie, here's the whole keyboard vibe check โŒจ๏ธ๐Ÿ’–

  • ? โ€” Open help + keys + about screen ๐ŸŒธ
  • up, down, j, k โ€” Cycle through the items ๐Ÿฆ‹
  • right, enter, l โ€” Open selected directory ๐Ÿ‘‘
  • left, <, h โ€” Go to parent directory โฌ†๏ธ
  • n โ€” Order by filename (press again for descending order) ๐Ÿ”ค
  • s โ€” Order by filesize (press again for descending order) ๐Ÿ“ฆ
  • C โ€” Order by number of items (press again for descending order) ๐Ÿ”ข
  • a โ€” Toggle between showing disk usage and showing apparent size ๐Ÿ’…
  • M โ€” Order by latest child mtime, or modified time (press again for descending order). Requires the -e flag โฐ
  • d โ€” Delete the selected file or directory. An error message will be shown when the contents of the directory do not match or do not exist anymore on the filesystem ๐Ÿ’€
  • t โ€” Toggle dirs before files when sorting ๐ŸŽ€
  • g โ€” Toggle between showing percentage, graph, both, or none. Percentage is relative to the size of the current directory, graph is relative to the largest item in the current directory ๐Ÿ“Š
  • u โ€” Toggle display of the shared / unique size column for directories that share hard links. This column is only visible if the current listing contains directories with shared hard links ๐Ÿ”—
  • c โ€” Toggle display of child item counts ๐Ÿงฎ
  • m โ€” Toggle display of latest child mtime, or modified time. Requires the -e flag โฑ๏ธ
  • e โ€” Show/hide 'hidden' or 'excluded' files and directories. Be aware that even if you can't see the hidden files and directories, they are still there and they are still included in the directory sizes. If you suspect that the totals shown at the bottom of the screen are not correct, make sure you haven't enabled this option ๐Ÿ‘€
  • i โ€” Show information about the current selected item โ„น๏ธ
  • r โ€” Refresh/recalculate the current directory ๐Ÿ”„
  • b โ€” Spawn shell in current directory ๐Ÿš

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 lets you also configure another command to be run when the 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

The 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 ๐ŸŒ€

  • q โ€” Quit โœŒ๏ธ

๐ŸŽ€ FILE FLAGS ๐ŸŽ€

Entries in the browser interface may be prefixed by a one-character flag. These flags have the following meaning, bestie โ€” learn them and you'll read the screen like a main character ๐Ÿ‘‘

  • ! โ€” An error occurred while reading this directory ๐Ÿ˜ญ
  • . โ€” An error occurred while reading a subdirectory, so the indicated size may not be correct ๐Ÿ™ˆ
  • < โ€” File or directory is excluded from the statistics by using exclude patterns ๐Ÿšซ
  • > โ€” Directory is on another filesystem ๐Ÿ—‚๏ธ
  • ^ โ€” Directory is excluded from the statistics due to being a Linux pseudo filesystem ๐Ÿง
  • @ โ€” This is neither a file nor a folder (symlink, socket, ...) โœจ
  • H โ€” Same file was already counted (hard link) ๐Ÿ”—
  • e โ€” Empty directory ๐Ÿซ™

๐Ÿ’– EXAMPLES ๐Ÿ’–

To scan and browse the directory you're currently in, all you need is a simple:

ncdu

To scan a full filesystem, for example your root filesystem, you'll want to use -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 export.ncdu /
# ...some time later:
ncdu -f export.ncdu

To export from a cron job, make sure to replace -1 with -0 to suppress unnecessary progress output ๐Ÿคซ

You can also export a directory and browse it once scanning is done:

ncdu -co- | tee export.json.zst | ./ncdu -f-

To scan a system remotely, but browse through the files locally:

ssh user@system ncdu -co- / | ./ncdu -f-

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. iconic behaviour honestly ๐Ÿ”ฅ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ


๐Ÿ’œ AUTHORS ๐Ÿ’œ

Written by Yorhel <projects@yorhel.nl>

๐Ÿ’€ BUGS (the tea on what's lowkey broken)

ok bestie, gather round, because we gotta be honest about the โœจimperfectionsโœจ. Nothing catastrophic, but you deserve to know fr fr.

  • Directory hard links and firmlinks (MacOS) are not supported. They don't get detected as hard links, so they just get scanned and counted multiple times. It's giving "double dipping at the snack table" ๐Ÿ“๐Ÿ™ˆ.
  • Some minor glitches may appear when displaying filenames that contain multibyte or multicolumn characters. Aesthetic only, no cap โ€” your files are fine, the display is just doing a lil dance ๐Ÿ’….
  • The unique and shared directory sizes are calculated based on the assumption that the link count of hard links does not change during a filesystem scan or in between refreshes. If that does happen โ€” like when a hard link gets deleted โ€” then those numbers will be very much incorrect ๐Ÿ˜ญ and you'll need a full refresh by restarting ncdu to get correct numbers again. No shortcuts, bestie, just restart it ๐Ÿซถ.
  • All sizes are internally represented as a signed 64bit integer. So if you somehow have a directory larger than 8 EiB minus one byte, ncdu will clip its size to 8 EiB minus one byte. And when you're deleting or refreshing items in a directory with a clipped size, the resulting sizes will be incorrect. Likewise, item counts are stored in a 32-bit integer, so they'll be incorrect in the unlikely event that you happen to have more than 4 billion items in a directory. Likeโ€ฆ if you're hitting that, honestly iconic, but also please go outside ๐ŸŒธ.

Please report any other bugs you may find at the bug tracker, which can be found on the web site at https://github.com/BratishkaErik/ncdu/issues. Do it for the girlies ๐ŸŽ€. Actual bugs get fixed, and that's the real main character energy ๐Ÿ‘‘.

and that's the whole page, bestie!! ๐Ÿ’– this one shipped with the Debian version, dated July 11, 2026, for the one and only NCDU(1) ๐Ÿฆ‹. now go scan some disks and slay โœจ๐Ÿ‘‘๐Ÿ’œ

๐Ÿ“ฆ where this page comes from