.\" SPDX-FileCopyrightText: Yorhel <projects@yorhel.nl>.\" SPDX-License-Identifier: MIT.Dd August 16, 2025.Dt NCDU 1.Os.Sh NAME.Nm ncdu.Nd NCurses Disk Usage..Sh SYNOPSIS.Nm.Op Fl f Ar file.Op Fl o Ar file.Op Fl O Ar file.Op Fl e , \-extended , \-no\-extended.Op Fl \-ignore\-config.Op Fl x , \-one\-file\-system , \-cross\-file\-system.Op Fl \-exclude Ar pattern.Op Fl X , \-exclude\-from Ar file.Op Fl \-include\-caches , \-exclude\-caches.Op Fl L , \-follow\-symlinks , \-no\-follow\-symlinks.Op Fl \-include\-kernfs , \-exclude\-kernfs.Op Fl t , \-threads Ar num.Op Fl c , \-compress , \-no\-compress.Op Fl \-compress\-level Ar num.Op Fl \-export\-block\-size Ar num.Op Fl 0 , 1 , 2.Op Fl q , \-slow\-ui\-updates , \-fast\-ui\-updates.Op Fl \-enable\-shell , \-disable\-shell.Op Fl \-enable\-delete , \-disable\-delete.Op Fl \-enable\-refresh , \-disable\-refresh.Op Fl r.Op Fl \-si , \-no\-si.Op Fl \-disk\-usage , \-apparent\-size.Op Fl \-show\-hidden , \-hide\-hidden.Op Fl \-show\-itemcount , \-hide\-itemcount.Op Fl \-show\-mtime , \-hide\-mtime.Op Fl \-show\-graph , \-hide\-graph.Op Fl \-show\-percent , \-hide\-percent.Op Fl \-graph\-style Ar hash | half\-block | eighth\-block.Op Fl \-shared\-column Ar off | shared | unique.Op Fl \-sort Ar column.Op Fl \-enable\-natsort , \-disable\-natsort.Op Fl \-group\-directories\-first , \-no\-group\-directories\-first.Op Fl \-confirm\-quit , \-no\-confirm\-quit.Op Fl \-confirm\-delete , \-no\-confirm\-delete.Op Fl \-delete\-command Ar command.Op Fl \-color Ar off | dark | dark-bg.Op Ar path.Nm.Op Fl h , \-help.Nm.Op Fl v , V , \-version..Sh DESCRIPTION.Nm(NCurses Disk Usage) is an interactive curses-based version of the well-known.Xr du 1 ,and provides a fast way to see what directories are using your disk space...Sh OPTIONS.Ss Mode Selection.Bl -tag -width Ds.It Fl h , \-helpPrint a short help message and quit..It Fl v , V , \-versionPrint version and quit..It Fl f Ar fileLoad the given file, which has earlier been created with the.Fl oor.Fl Oflag.If.Ar fileis equivalent to '\-', the file is read from standard input.Reading from standard input is only supported for the JSON format..PpFor the sake of preventing a screw-up, the current version of.Nmwill assume that the directory information in the imported file does notrepresent the filesystem on which the file is being imported.That is, the refresh, file deletion and shell spawning options in the browserwill be disabled..It Ar dirScan the given directory..It Fl o Ar fileExport the directory tree in JSON format to.Ar fileinstead of opening the browser interface.If.Ar fileis '\-', the data is written to standard output.See the examples section below for some handy use cases..PpBe warned that the exported data may grow quite large when exporting adirectory with many files.10.000 files will get you an export in the order of 600 to 700 KiBuncompressed, or a little over 100 KiB when compressed with gzip.This scales linearly, so be prepared to handle a few tens of megabytes whendealing with millions of files..PpConsider enabling.Fl cto output Zstandard-compressed JSON, which can significantly reduce size of theexported data..PpWhen running a multi-threaded scan or when scanning a directory tree that maynot fit in memory, consider using.Fl Oinstead..It Fl O Ar fileExport the directory tree in binary format to.Ar fileinstead of opening the browser interface.If.Ar fileis '\-', the data is written to standard output.The binary format has built-in compression, supports low-memory multi-threadedexport (in combination with.Fl t )and can be browsed without importing the entire directory tree into memory..It Fl e , \-extended , \-no\-extendedEnable/disable extended information mode.This will, in addition to the usual file information, also read the ownership,permissions and last modification time for each file.This will result in higher memory usage (by roughly ~30%) and in a largeroutput file when exporting..PpWhen using the file export/import function, this flag should be added both whenexporting (to make sure the information is added to the export) and whenimporting (to read this extra information in memory).This flag has no effect when importing a file that has been exported withoutthe extended information..PpThis enables viewing and sorting by the latest child mtime, or modified time,using 'm' and 'M', respectively..It Fl \-ignore\-configDo not attempt to load any configuration files..El..Ss Scan OptionsThese options affect the scanning progress, they have no effect when importingdirectory information from a file..Bl -tag -width Ds.It Fl x , \-one\-file\-systemDo not cross filesystem boundaries, i.e. only count files and directories onthe same filesystem as the directory being scanned..It Fl \-cross\-file\-systemDo cross filesystem boundaries.This is the default, but can be specified to overrule a previously configured.Fl x ..It Fl \-exclude Ar patternExclude files that match.Ar pattern .The files are still displayed by default, but are not counted towards the diskusage statistics.This argument can be added multiple times to add more patterns..It Fl X , \-exclude\-from Ar fileExclude files that match any pattern in.Ar file .Patterns should be separated by a newline..It Fl \-include\-caches , \-exclude\-cachesInclude (default) or exclude directories containing.Pa CACHEDIR.TAG .Excluded cache directories are still displayed, but their contents will not bescanned or counted towards the disk usage statistics..Lk https://bford.info/cachedir/.It Fl L , \-follow\-symlinks , \-no\-follow\-symlinksFollow (or not) symlinks and count the size of the file they point to.This option does not follow symlinks to directories and will cause eachsymlinked file to count as a unique file.This is different from how hard links are handled.The exact counting behavior of this flag is subject to change in the future..It Fl \-include\-kernfs , \-exclude\-kernfs(Linux only) Include (default) or exclude Linux pseudo filesystems such as.Pa /proc(procfs) and.Pa /sys(sysfs)..PpThe complete list of currently known pseudo filesystems is: binfmt, bpf, cgroup,cgroup2, debug, devpts, proc, pstore, security, selinux, sys, trace..It Fl t , \-threads Ar numNumber of threads to use when scanning the filesystem, defaults to 1..PpIn single-threaded mode, the JSON export (see.Fl o )can operate with very little memory, but in multi-threaded mode the entiredirectory tree is first constructed in memory and written out after thefilesystem scan has completed,This causes a delay in output and requires significantly more memory for largedirectory trees.The binary format (see.Fl O )does not have this problem and supports efficient exporting with any number ofthreads..El..Ss Export OptionsThese options affect behavior when exporting to file with the.Fl oor.Fl Ooptions..Bl -tag -width Ds.It Fl c , \-compress , \-no\-compressEnable or disable Zstandard compression when exporting to JSON (see.Fl o ) ..It Fl \-compress\-level Ar numSet the Zstandard compression level when using.Fl Oor.Fl c .Valid values are 1 (fastest) to 19 (slowest).Defaults to 4..It Fl \-export\-block\-size Ar numSet the block size, in kibibytes, for the binary export format (see.Fl O ) .Larger blocks require more memory but result in better compression efficiency.This option can be combined with a higher.Fl \-compress\-levelfor even better compression..PpAccepted values are between 4 and 16000.The defaults is to start at 64 KiB and then gradually increase the block sizefor large exports..El..Ss Interface Options.Bl -tag -width Ds.It Fl 0Don't give any feedback while scanning a directory or importing a file, exceptwhen a fatal error occurs.Ncurses will not be initialized until the scan is complete.When exporting the data with.Fl o ,ncurses will not be initialized at all.This option is the default when exporting to standard output..It Fl 1Write progress information to the terminal, but don't open a full-screenncurses interface.This option is the default when exporting to a file..PpIn some cases, the ncurses browser interface which you'll see after thescan/import is complete may look garbled when using this option.If you're not exporting to a file,.Fl 2is usually a better choice..It Fl 2Show a full-screen ncurses interface while scanning a directory or importinga file.This is the only interface that provides feedback on any non-fatal errors whilescanning..It Fl q , \-slow\-ui\-updates , \-fast\-ui\-updatesChange the UI update interval while scanning or importing..Nmupdates the screen 10 times a second by default (with.Fl \-fast\-ui\-updates), this can be decreased to once every 2 seconds with.Fl qor.Fl \-slow\-ui\-updates .This option can be used to save bandwidth over remote connections.This option has no effect in combination with.Fl 0 ..It Fl \-enable\-shell , \-disable\-shellEnable or disable shell spawning from the file browser.This feature is enabled by default when scanning a live directory and disabledwhen importing from file..It Fl \-enable\-delete , \-disable\-deleteEnable or disable the built-in file deletion feature.This feature is enabled by default when scanning a live directory and disabledwhen importing from file.Explicitly disabling the deletion feature can work as a safeguard to preventaccidental data loss..It Fl \-enable\-refresh , \-disable\-refreshEnable or disable directory refreshing from the file browser.This feature is enabled by default when scanning a live directory and disabledwhen importing from file..It Fl rRead-only mode.When given once, this is an alias for.Fl \-disable\-delete ,when given twice it will also add.Fl \-disable\-shell ,thus ensuring that there is no way to modify the file system from within.Nm ..It Fl \-si , \-no\-siList sizes using base 10 prefixes, that is, powers of 1000 (kB, MB, etc), asdefined in the International System of Units (SI), instead of the usual base 2prefixes (KiB, MiB, etc)..It Fl \-disk\-usage , \-apparent\-sizeSelect whether to display disk usage (default) or apparent sizes.Can also be toggled in the file browser with the 'a' key..It Fl \-show\-hidden , \-hide\-hiddenShow (default) or hide "hidden" and excluded files.Can also be toggled in the file browser with the 'e' key..It Fl \-show\-itemcount , \-hide\-itemcountShow or hide (default) the item counts column.Can also be toggled in the file browser with the 'c' key..It Fl \-show\-mtime , \-hide\-mtimeShow or hide (default) the last modification time column.Can also be toggled in the file browser with the 'm' key.This option is ignored when not in extended mode, see.Fl e ..It Fl \-show\-graph , \-hide\-graphShow (default) or hide the relative size bar column.Can also be toggled in the file browser with the 'g' key..It Fl \-show\-percent , \-hide\-percentShow (default) or hide the relative size percent column.Can also be toggled in the file browser with the 'g' key..It Fl \-graph\-style Ar hash | half\-block | eighth\-blockChange the way that the relative size bar column is drawn.Recognized values are.Ar hashto draw ASCII '#' characters (default and most portable),.Ar half\-blockto use half-block drawing characters or.Ar eighth\-blockto use eighth-block drawing characters.Eighth-block characters are the most precise but may not render correctly inall terminals..It Fl \-shared\-column Ar off | shared | uniqueSet to.Ar offto disable the shared size column for directories,.Ar shared(default) to display shared directory sizes as a separate column or.Ar uniqueto display unique directory sizes as a separate column.These options can also be cycled through in the file browser with the 'u' key..It Fl \-sort Ar columnChange the default column to sort on.Accepted values are.Ar disk\-usage(the default),.Ar name , apparent\-size , itemcountor.Ar mtime .The latter only makes sense in extended mode, see.Fl e ..PpThe column name can be suffixed with.Li \-ascor.Li \-descto change the order to ascending or descending, respectively.For example,.Li \-\-sort=name\-descto sort by name in descending order..It Fl \-enable\-natsort , \-disable\-natsortEnable (default) or disable natural sort when sorting by file name..It Fl \-group\-directories\-first , \-no\-group\-directories\-firstSort (or not) directories before files..It Fl \-confirm\-quit , \-no\-confirm\-quitRequire a confirmation before quitting ncdu.Can be helpful when you accidentally press 'q' during or after a very long scan..It Fl \-confirm\-delete , \-no\-confirm\-deleteRequire a confirmation before deleting a file or directory.Enabled by default, but can be disabled if you're absolutely sure you won'taccidentally press 'd'..It Fl \-delete\-command Ar commandWhen set to a non-empty string, replace the built-in file deletion feature witha custom shell command..PpThe absolute path of the item to be deleted is appended to the given commandand the result is evaluated in a shell.The command is run from the same directory that ncdu itself was started in.The.Ev NCDU_DELETE_PATHenvironment variable is set to the absolute path of the item to be deleted and.Ev NCDU_LEVELis set in the same fashion as when spawning a shell from within ncdu..PpAfter command completion, the in-memory view of the selected item is refreshedand directory sizes are adjusted as necessary.This is not a full refresh of the complete directory tree, so if the item hasbeen renamed or moved to another directory, it's new location is notautomatically picked up..PpFor example, to use.Xr rm 1interactive mode to prompt before each deletion:.Dl ncdu --no-confirm-delete --delete-command \[aq]rm -ri --\[aq]Or to move files to trash:.Dl ncdu --delete-command \[aq]gio trash --\[aq].It Fl \-color Ar off | dark | dark-bgSet the color scheme.The following schemes are recognized:.Ar offto disable colors,.Ar darkfor a color scheme intended for dark backgrounds and.Ar dark\-bgfor a variation of the.Ar darkcolor scheme that also works in terminals with a light background..PpThe default is.Ar off ..El..Sh CONFIGURATION.Nmcan be configured by placing command-line options in.Pa /etc/ncdu.confor.Pa $HOME/.config/ncdu/config .If both files exist, the system configuration will be loaded before the userconfiguration, allowing users to override options set in the systemconfiguration.Options given on the command line will override options set in theconfiguration files.The files will not be read at all when.Fl \-ignore\-configis given on the command line..PpThe 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:.Bd -literal -offset indent# 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.Ed..Sh KEYS.Bl -tag -width Ds.It ?Open help + keys + about screen.It up , down , j , kCycle through the items.It right, enter, lOpen selected directory.It left, <, hGo to parent directory.It nOrder by filename (press again for descending order).It sOrder by filesize (press again for descending order).It COrder by number of items (press again for descending order).It aToggle between showing disk usage and showing apparent size..It MOrder by latest child mtime, or modified time (press again for descendingorder).Requires the.Fl eflag..It dDelete the selected file or directory.An error message will be shown when the contents of the directory do not matchor do not exist anymore on the filesystem..It tToggle dirs before files when sorting..It gToggle between showing percentage, graph, both, or none.Percentage is relative to the size of the current directory, graph is relativeto the largest item in the current directory..It uToggle display of the shared / unique size column for directories that sharehard links.This column is only visible if the current listing contains directories withshared hard links..It cToggle display of child item counts..It mToggle display of latest child mtime, or modified time.Requires the.Fl eflag..It eShow/hide 'hidden' or 'excluded' files and directories.Be aware that even if you can't see the hidden files and directories, they arestill there and they are still included in the directory sizes.If you suspect that the totals shown at the bottom of the screen are notcorrect, make sure you haven't enabled this option..It iShow information about the current selected item..It rRefresh/recalculate the current directory..It bSpawn shell in current directory..Pp.Nmdetermines your preferred shell from the.Ev NCDU_SHELLor.Ev SHELLenvironment variable (in that order), or calls.Pa /bin/shif neither are set.This allows you to also configure another command to be run when he 'b' key ispressed.For example, to spawn the.Xr vifm 1file manager instead of a shell, run.Nmas follows:.Dl NCDU_SHELL=vifm ncduThe.Ev NCDU_LEVELenvironment variable is set or incremented before spawning the shell, allowingyou to detect if your shell is running from within.Nm .This can be useful to avoid nesting multiple instances, although.Nmitself does not (currently) warn about or prevent this situation..It qQuit.El..Sh FILE FLAGSEntries in the browser interface may be prefixed by a one\-character flag.These flags have the following meaning:.Bl -tag -width Ds.It !An error occurred while reading this directory..It \.An error occurred while reading a subdirectory, so the indicated size may notbe correct..It <File or directory is excluded from the statistics by using exclude patterns..It >Directory is on another filesystem..It ^Directory is excluded from the statistics due to being a Linux pseudofilesystem..It @This is neither a file nor a folder (symlink, socket, ...)..It HSame file was already counted (hard link)..It eEmpty directory..El..Sh EXAMPLESTo scan and browse the directory you're currently in, all you need is a simple:.Dl ncduTo scan a full filesystem, for example your root filesystem, you'll want to use.Fl x :.Dl ncdu \-x /.PpSince scanning a large directory may take a while, you can scan a directory andexport the results for later viewing:.Bd -literal -offset indentncdu \-1xO export.ncdu /# ...some time later:ncdu \-f export.ncdu.EdTo export from a cron job, make sure to replace.Fl 1with.Fl 0to suppress unnecessary progress output..PpYou can also export a directory and browse it once scanning is done:.Dl ncdu \-co\- | tee export.json.zst | ./ncdu \-f\-.PpTo scan a system remotely, but browse through the files locally:.Dl ssh user@system ncdu \-co\- / | ./ncdu \-f\-Remote scanning and local viewing has two major advantages whencompared to running.Nmdirectly on the remote system: You can browse through the scanned directory onthe local system without any network latency, and.Nmdoes not keep the entire directory structure in memory when exporting, so thiswon't consume much memory on the remote system...Sh SEE ALSO.Xr du 1 ,.Xr tree 1 ..Pp.Nmhas a website:.Lk https://dev.yorhel.nl/ncdu..Sh AUTHORSWritten by.An Yorhel Aq Mt projects@yorhel.nl..Sh BUGSDirectory hard links and firmlinks (MacOS) are not supported.They are not detected as being hard links and will thus get scanned and countedmultiple times..PpSome minor glitches may appear when displaying filenames that contain multibyteor multicolumn characters..PpThe unique and shared directory sizes are calculated based on the assumptionthat the link count of hard links does not change during a filesystem scan orin between refreshes.If this does happen, for example when a hard link is deleted, then thesenumbers will be very much incorrect and a full refresh by restarting ncdu isneeded to get correct numbers again..PpAll sizes are internally represented as a signed 64bit integer.If you have a directory larger than 8 EiB minus one byte, ncdu will clip itssize to 8 EiB minus one byte.When deleting or refreshing items in a directory with a clipped size, theresulting sizes will be incorrect.Likewise, item counts are stored in a 32-bit integer, so will be incorrect inthe unlikely event that you happen to have more than 4 billion items in adirectory..PpPlease report any other bugs you may find at the bug tracker, which can befound on the web site at.Lk https://dev.yorhel.nl/ncdu