ncdu

From LinuxReviews
Jump to navigationJump to search
NCurses Disk Usage
ncdu v1.15.1
ncdu v1.15.1
Developer(s)Yoran Heling
Initial releaseFebruary 21, 2007; 14 years ago (2007-02-21)
Repositoryg.blicky.net/ncdu.git/
Written inC
Operating systemLinux, BSD, macOS
PlatformPOSIX
TypeDisk utility
LicenseMIT
Websitedev.yorhel.nl/ncdu
Konsole.svg

ncdu (NCurses Disk Usage) is a shell utility that lets you quickly and easily see how much space the sub-folders in a directory are using. It gives you the same information du does in a much more convenient way.

ncdu is very fast, you will not have to wait noticeably long even if you have very large folders with lots and lots of files in them.

You can use the and arrows to navigate between folders and enter folders by pressing ↵ Enter. ncdu supports very basic file management, you can eradicate files by pressing d. Pressing d will give you a warning, so you won't accidentally remove files less you select don't ask me again when you are asked if you are sure you want to delete a file (it isn't stored, so you will be asked again the next time you open ncdu).

n, s and c can be used to sort files by name, size and item name respectively. t toggles if directories should be shown before files or not. g toggles the size graph, on by default, on or off.

The standard q for quit key closes ncdu.

ncdu will, by default, show you the sizes of sub-folders in the current folder. You can point elsewhere by providing a folder as an argument. It only takes one; only the last folder you list is the only one it cares about if you try to point it at more than one.

ncdu can, optionally, export the directory sizes in the folder you run it on by specifying the -o command line option.

ncdu will, by default, give you a plain two-colored black and white interface (or other two-colored interface, your terminal colors may vary). It has a --color option that allows you to start it with multiple colors so directory sizes have one colors and file listings have another. While it is supposed to support color schemes, there's currently only one available: dark. The only valid parameters for turning color on is therefore ncdu --color dark. You may want to make this an alias for ncdu since it does not have, or support, any configuration file.

Ncdu-with-colors.jpg
ncdu with colors enabled by ncdu --color dark

You can start ncdu with --si if you prefer sizes in powers of then (KB, MB) instead of powers of 1024 (KiB, MiB). See multiples of bytes if you don't get the difference.

The ncdu manual page lists several other options including a -e option for "extended information". ncdu /folder/ and ncdu -e /folder/ looks exactly the same, so it is unclear to us what, if any, additional information the -e option is supposed to show.

Verdict And Conclusion

ncdu is really useful if you want to quickly see what folders are using most of your disk storage space. It is one of those tools you will likely use a lot once you have become aware of its existence. And now you are.

Installation

All the distributions have ncdu available as a package with that name. A few like Alpine Linux separate the documentation into a option package named ncdu-doc (most include the documentation in the ncdu package).

Alternatives

Links

avatar

Tumeo

8 days ago
Score 0++

Nice, I think "dua" can also be a good alternative: https://gith...yron/dua-cli

It's written in Rust btw.
Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.