8

I like the navigation and features of ncdu, but instead of ranking folders by size, I want to rank them by file-count. For example, folders containing more files are listed first, and you can navigate the hierarchy using your arrow keys.

Are there any options to accomplish this? If not, I wonder how difficult it would be to modify the source code to provide the feature I'm wanting. Perhaps there is something else that does this already?

1 Answer 1

17

If you press C (capital “C”, so ShiftC or C with Caps Lock on) while in ncdu, the display will be sorted by file count rather than size. c (lower-case “c”) will show the file count in addition to the size (regardless of the sort criterion).

This shows the file count sort in action:

Firectories and files sorted by count, not size

This feature was added in ncdu 1.10 (May 2013).

3
  • 1
    This feature is also available in gdu using the same key commands. Apr 20, 2023 at 11:41
  • @DanielHarding This feature must of been recently added to gdu; I'm not seeing it in the package provided by Debian 12 (gdu version 4.6.3-1+b4). While gdu is pretty and fast, this version I'm using isn't able to navigate mounted NTFS network-drives like ncdu can. It reports usage for them, but if you try to drill in, it won't list the files. Dec 10, 2023 at 16:58
  • It looks like those key bindings were added in gdu 5.0, released in May 2021. Debian 12 (bookworm) looks to have have gdu version 5.22, which should work fine. The version you are using (gdu 4.6.3-1+b4) looks to be the version from Debian 11 (bullseye). Dec 11, 2023 at 17:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .