This tool has been pretty invaluable to me over the years in diagnosing/tracing high disk usage, particularly relevant for pypi and npm packages that were needlessly shipping huge artifacts.
This program is extremely useful. I have recently performed a recovery on a bricked Microsoft Surface and was able to extract all the useful files from a Windows home directory and quickly discard all the libraries, caches, and so on. By seeing the folders that take up the most space you can easily determine what the juicy bits in a folder hierarchy are. Huge time saver.
Using GrandPerspective on macOS was a similar revelation, but ncdu being keyboard driven and allowing you to quickly launch a shell inside each folder and then apply find -exec there quickly is a productivity boost on yet another level.
If you use a Btrfs filesystem with snapshots, I can recommend Btdu as an alternative. Advantage: Can handle duplicate files (snapshots), which however only occupy 1x disk space.
More interesting than its support of Btrfs features is its unusual statistical approach:
> btdu is a sampling disk usage profiler […] Pick a random point on the disk then find what is located at that point […] btdu starts showing results instantly. Though wildly inaccurate at first, they become progressively more accurate the longer btdu is allowed to run.
I never knew about this tool, but it looks quite useful--much better than just using df.
The only thing I wish it had was a squarified treemap view of disk space. There was an old graphical tool for Windows called SequoiaView that I used to use years ago, and I've never found a worthy replacement for it on Linux or MacOS.
On a Mac, I've been using OmniDiskSweeper for years, but this can be run in a single directory and on my Linux machines as well. Fantastic!
And look, it didn't ask me to sign up for an account, and it didn't require me to consent to usage data collection with a huge Privacy Policy attached! How is that possible? (still dealing with this morning's scars from trying, and failing to run the warp terminal)
The other big advantage over just being a gui is that it Scans the filesystem ahead of time and keeps the data across your navigation into directories.
du will have to rescan as you traverse down the tree
ncdu is fabulous. I used it a while back on my 2009 Mac mini and recovered 40GB of disk space. 8GB of this was in just four folders: ~/Library/Logs/CrashReporter/MobileDevice, /private/var/db/systemstats, /System/Library/Caches/com.apple.coresymbolicationd, and /Library/Caches/com.apple.iconservices.store.
If you like ncdu, you might also like dua[0]. You can run `dua i` to get an interface similar to ncdu, and can also run `dua` to list file sizes in the current directory, similar to `du`. Or `dua filename` to get the size of a given file.
Actually it is in the arch community repositories and seems to be quiet a bit faster than ncdu so I will keep it in my toolbox for now.
Painpoints are that there seems to be no progress bar in interactive mode, the ui is (imho) ugly/unintuitive (for instance the usage bar seems to be relative? and the shortcuts look like glyphs) and there are functions missing (like exclude patterns, you can exclude dirs though!).
So it won't replace ncdu, but if it get a interactive progressbar maybe it will be on all my machines (with arch)
Interesting. I’ve just used df-m | sort -n and walked the tree from the CLI for so long.
I’ve also used windirstat (I think that’s what it was called) years ago on Windows and Disk Inventory X on MacOS graphically.
This seems like a nice in between that could replace both methods for me. I’ll have to try.
The GUI bunch of squares is really only useful when you can hover with a mouse and would be clunky in a TUI even if you could render it. And the FS structure isn’t immediately obvious, so I find myself wasting time wandering hovering over big files and globs of little ones.
I really like to avoid a mouse when I can unless it’s really useful.
> I’ve also used windirstat (I think that’s what it was called) years ago on Windows and Disk Inventory X on MacOS graphically.
On Windows, the new hotness is WizTree, which rather than recursively calling directory listing functions, it directly reads and parses the file tables itself. This makes it orders of magnitude faster. I have a 2 TB hard drive full of a million files, and WizTree reads and parses it all in under a minute, whereas I can expect WinDirStat to take half an hour.
My windows experience is really out of date. I knew NT4 and 2000 the best. Then I picked up 2008 for a while supporting small businesses. I don't hate it or anything, but am definitely deeper on Unixes and about equal on VMS that I supported as my NT4/2000 time. I'll work on whatever pays :).
I use ncdu almost daily across many different systems. Especially handy when running macOS on a <512GB volume and you need to keep an eye on ballooning caches and other "helpful" cruft.
`rmlint` and `jdupes` are also seeing a lot of use here lately, reclaiming terabytes of space from years of sloppy media organization (or the lack thereof!)
Thanks for sharing! I really like the real time update during progress. You sometimes have to wait a very long time in Scanner before you see the result.
On Windows, you should switch to WizTree. Rather than recursively calling directory listing functions, it directly reads and parses the file tables itself. This makes it orders of magnitude faster. I have a 2 TB hard drive full of a million files, and WizTree reads and parses it all in under a minute, whereas I can expect WinDirStat to take half an hour.
For all the hate NTFS gets, MFT has led to the creation to two amazing tools: Everything and WizTree. Unfortunately both proprietary although freeware.
You should try Directory Report on Windows.
It is faster than WinDirStat.
Has more filtering and reporting than WinDirStat.
Can find duplicate files too
You should switch to WizTree. Rather than recursively calling directory listing functions, it directly reads and parses the file tables itself. This makes it orders of magnitude faster. I have a 2 TB hard drive full of a million files, and WizTree reads and parses it all in under a minute, whereas I can expect WinDirStat to take half an hour.
Have been using ncdu for more than a decade, and recently started using diskonaut for similar purposes. Was looking for a terminal-based treemap visualization for analyzing disk usage and stumbled upon diskonaut, which is exactly that.
I use ncdu a lot. It’s not strictly necessary but it’s really nice to have in the toolbox. Also IIRC there is a standalone binary available which comes in handy when you can’t install packages on a full filesystem.
167 comments
[ 2.7 ms ] story [ 224 ms ] threadUsing GrandPerspective on macOS was a similar revelation, but ncdu being keyboard driven and allowing you to quickly launch a shell inside each folder and then apply find -exec there quickly is a productivity boost on yet another level.
https://github.com/CyberShadow/btdu
> btdu is a sampling disk usage profiler […] Pick a random point on the disk then find what is located at that point […] btdu starts showing results instantly. Though wildly inaccurate at first, they become progressively more accurate the longer btdu is allowed to run.
The only thing I wish it had was a squarified treemap view of disk space. There was an old graphical tool for Windows called SequoiaView that I used to use years ago, and I've never found a worthy replacement for it on Linux or MacOS.
On a Mac, I've been using OmniDiskSweeper for years, but this can be run in a single directory and on my Linux machines as well. Fantastic!
And look, it didn't ask me to sign up for an account, and it didn't require me to consent to usage data collection with a huge Privacy Policy attached! How is that possible? (still dealing with this morning's scars from trying, and failing to run the warp terminal)
du will have to rescan as you traverse down the tree
[0] https://github.com/Byron/dua-cli
Painpoints are that there seems to be no progress bar in interactive mode, the ui is (imho) ugly/unintuitive (for instance the usage bar seems to be relative? and the shortcuts look like glyphs) and there are functions missing (like exclude patterns, you can exclude dirs though!).
So it won't replace ncdu, but if it get a interactive progressbar maybe it will be on all my machines (with arch)
I’ve also used windirstat (I think that’s what it was called) years ago on Windows and Disk Inventory X on MacOS graphically.
This seems like a nice in between that could replace both methods for me. I’ll have to try.
The GUI bunch of squares is really only useful when you can hover with a mouse and would be clunky in a TUI even if you could render it. And the FS structure isn’t immediately obvious, so I find myself wasting time wandering hovering over big files and globs of little ones.
I really like to avoid a mouse when I can unless it’s really useful.
However I use ncdu all the time.
On Windows, the new hotness is WizTree, which rather than recursively calling directory listing functions, it directly reads and parses the file tables itself. This makes it orders of magnitude faster. I have a 2 TB hard drive full of a million files, and WizTree reads and parses it all in under a minute, whereas I can expect WinDirStat to take half an hour.
My windows experience is really out of date. I knew NT4 and 2000 the best. Then I picked up 2008 for a while supporting small businesses. I don't hate it or anything, but am definitely deeper on Unixes and about equal on VMS that I supported as my NT4/2000 time. I'll work on whatever pays :).
`rmlint` and `jdupes` are also seeing a lot of use here lately, reclaiming terabytes of space from years of sloppy media organization (or the lack thereof!)
http://www.steffengerlach.de/freeware/
On an SSD, WizTree only takes a couple seconds.
https://windirstat.net/
On an SSD, WizTree only takes a couple seconds.
https://diskanalyzer.com/wiztree-old-versions
ncdu -x to instruct it not to traverse foreign filesystems
(I should probably look into this...)
xdiskusage -qa /
https://github.com/imsnif/diskonaut