modern-unix icon indicating copy to clipboard operation
modern-unix copied to clipboard

Consider adding ncdu

Open danBhentschel opened this issue 3 years ago • 17 comments

Another alternative to du is ncdu. I use this all the time to analyze my disk usage. Give it a whirl and see if you think it makes sense to add it to this list.

danBhentschel avatar Jun 23 '21 12:06 danBhentschel

ncdu isn't cross platform. I'd suggest a modern rewrite in Go - gdu - which is 100x faster than ncdu (in my limited testing) and is cross platform.

rashil2000 avatar Jun 23 '21 19:06 rashil2000

#17 :wink:

ibraheemdev avatar Jun 23 '21 19:06 ibraheemdev

gdu and dua seem to be the most "modern" and maintained disk usage tools.

ibraheemdev avatar Jun 23 '21 19:06 ibraheemdev

it's 14 years old, and obviously not as hip

t184256 avatar Jun 24 '21 19:06 t184256

I love ncdu, but it isn't fast and some of these other tools do look better.

anacrolix avatar Jun 27 '21 22:06 anacrolix

ncdu has more features, that others don't have. For example:

       Since scanning a large directory may take a while, you can scan a directory and export the results for
       later viewing:

         ncdu -1xo- / | gzip >export.gz
         # ...some time later:
         zcat export.gz | ncdu -f-

jtagcat avatar Jul 04 '21 17:07 jtagcat

https://github.com/rclone/rclone is cross-platform and has ncdu command, works for cloud, local, ftp, http(s), etc.

catthehacker avatar Jul 08 '21 10:07 catthehacker

https://rclone.org/commands/rclone_ncdu

It is missing lots of features at the moment but is useful as it stands.

rclone's ncdu-like small interface is poorer than actual ncdu, and it's not rclone's main thing.

jtagcat avatar Jul 09 '21 19:07 jtagcat

ncdu is a go-to thing. It's exemplary. It's something easy to apt install and it gets the job done. But is it really modern compared to the others in the list?

What's modern about ncdu?

MrMino avatar Jul 10 '21 02:07 MrMino

https://rclone.org/commands/rclone_ncdu

It is missing lots of features at the moment but is useful as it stands.

rclone's ncdu-like small interface is poorer than actual ncdu, and it's not rclone's main thing.

Plus rclone will take your code and modify it without copyright assignment or attribution: https://github.com/rclone/rclone/issues/4101.

anacrolix avatar Jul 11 '21 00:07 anacrolix

What's modern about ncdu?

That it exists. It doesn't have to replace the same implementation to be modern. Going by the repo's definition, it's a saner, and more efficient* alternative to ls, du, and others.

* for the user. A minute saved of human time is often valued more, than 10s of compute.

I discovered ncdu through rclone. I would've much appreciated it, if I had known of ncdu sooner.

Yes, many say new, partial implementations are modern; yet is it what we seek to highlight here?


Plus rclone will take your code and modify it without copyright assignment or attribution: rclone/rclone#4101.

Seriously, please stop bike shedding. rclone has hundreds of contributors. The mishap got acknowledged by parties involved, and not involved. It's on the pipeline to be improved on, you haven't been ignored. If you are majorly distressed, and need attention, please seek for a better place to vent.

jtagcat avatar Jul 13 '21 08:07 jtagcat

I'm not against adding ncdu, it's a great tool and imo, it's "modern". I've mentioned rclone since it's also "modern" and works well with remote file systems.

catthehacker avatar Jul 13 '21 10:07 catthehacker

@jtagcat

But is it really modern compared to the others in the list? What's modern about ncdu?

That it exists.

How about when comparing to others? How does it compare to gdu? gdu certainly exists, right?

Lots of tools exist, they don't have to land on the "Modern Unix" list just because they have a sensible TUI strapped on.

Don't get me wrong, I use this tool whenever I need to clean a partition up, but to put it in the same category of "modern" when better alternatives exist just doesn't sit well with me. "Everyone knows ncdu exists", it doesn't really require any more fame at this point.

It even has its own wikipedia page...

Yes, many say new, partial implementations are modern; yet is it what we seek to highlight here?

Is gdu partial? Can you please elaborate on what you are referring to?

What I'd love to see highlighted is the tools that move the space forward, not the established ones that doesn't really need any introduction.

MrMino avatar Jul 13 '21 10:07 MrMino

Lots of tools exist, they don't have to land on the "Modern Unix" list just because they have a sensible TUI strapped on.

Yes, they also don't have to be written in Go or Rust and don't need fancy colours to be modern.

Don't get me wrong, I use this tool whenever I need to clean a partition up, but to put it in the same category of "modern" when better alternatives exist just doesn't sit well with me.

Define better. To me it seems very subjective since there isn't a better alternative to ncdu currently. If there was a better alternative, certainly you wouldn't use ncdu.

"Everyone knows ncdu exists", it doesn't really require any more fame at this point.

This proves that not everyone knows about ncdu ;) I myself didn't knew about ncdu for a very long time and wish I would

It even has its own wikipedia page...

If you decide if something is "famous" based on Wikipedia article...

Yes, many say new, partial implementations are modern; yet is it what we seek to highlight here?

Is gdu partial? Can you please elaborate on what you are referring to?

They are referring to options available between ncdu and gdu. "modern" tools usually don't have all options available. You can just read --help for both and see yourself. There is also an example here: https://github.com/ibraheemdev/modern-unix/issues/18#issuecomment-873626985 + difference inside gdu and ncdu

┌───ncdu help─────────────────1:Keys───2:Format───3:About──┐
│                                                          │
│       up, k  Move cursor up                              │
│     down, j  Move cursor down                            │
│ right/enter  Open selected directory                     │
│  left, <, h  Open parent directory                       │
│           n  Sort by name (ascending/descending)         │
│           s  Sort by size (ascending/descending)         │
│           C  Sort by items (ascending/descending)        │
│           M  Sort by mtime (-e flag)                     │
│           d  Delete selected file or directory           │
│           t  Toggle dirs before files when sorting       │
│           g  Show percentage and/or graph                │
│           a  Toggle between apparent size and disk usage │
│           c  Toggle display of child item counts         │
│           m  Toggle display of latest mtime (-e flag)    │
│           e  Show/hide hidden or excluded files          │
│           i  Show information about selected item        │
│           r  Recalculate the current directory           │
│           b  Spawn shell in current directory            │
│           q  Quit ncdu                                   │
│                                                          │
│                                         Press q to close │
└──────────────────────────────────────────────────────────┘
┌────────────────────────────────── gdu help ──────────────────────────────────┐
│                                                                              │
│                                                                              │
│                                                                              │
│    up, down, k, j    Move cursor up/down                                     │
│  pgup, pgdn, g, G    Move cursor top/bottom                                  │
│   enter, right, l    Select directory/device                                 │
│           left, h    Go to parent directory                                  │
│                 d    Delete selected file or directory                       │
│                 e    Empty selected file or directory                        │
│                 v    Show content of selected file                           │
│                 i    Show info about selected item                           │
│                 r    Rescan current directory                                │
│                 a    Toggle between showing disk usage and apparent size     │
│                 c    Show/hide file count                                    │
│                 n    Sort by name (asc/desc)                                 │
│                 s    Sort by size (asc/desc)                                 │
│                 C    Sort by file count (asc/desc)                           │
│                                                                              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

and for fun, rclone ncdu:

┌─────────────────────────────────────────────┐
│rclone ncdu                                  │
│ ↑,↓ or k,j to Move                          │
│ →,l to enter                                │
│ ←,h to return                               │
│ c toggle counts                             │
│ g toggle graph                              │
│ a toggle average size in directory          │
│ n,s,C,A sort by name,size,count,average size│
│ d delete file/directory                     │
│ Y display current path                      │
│ ^L refresh screen                           │
│ ? to toggle help on and off                 │
│ q/ESC/c-C to quit                           │
└─────────────────────────────────────────────┘

When you are coming from a "featureful" tool to a tool with less features than previous one, it's only a matter of time when you will try to use some feature that doesn't exist.

also the fact that gdu binary is 6.2 MiB (or 4.5 MiB stripped) while static ncdu is 408 KiB

What I'd love to see highlighted is the tools that move the space forward, not the established ones that doesn't really need any introduction.

What I'd love to see is one tool with many features that suits many needs and not 10 different tools with same goal that each has some features.

catthehacker avatar Jul 14 '21 08:07 catthehacker

Yes, they also don't have to be written in Go or Rust [...] to be modern

Oh, but they can actually. These tools are modern in at least that the toolchain is modern. It made them better in some particular way, from the old approach of using just C (or Fortran, or Ada, or Pascal, or whichever is your thing): some are memory safe, some cross-platform, etc. They definitely reap the benefits of being built with something modern, and not with C.

[They] don't need fancy colours to be modern.

This is a strawman. And also, ncdu has color schemes.

"Everyone knows ncdu exists", it doesn't really require any more fame at this point.

This proves that not everyone knows about ncdu ;)

This proves nothing. And also disproves nothing. It's a figure of speech. I was pointing out that it is established enough so that it doesn't really need separate mention on this list, hence the quotes.

If you decide if something is "famous" based on Wikipedia article...

No, but I can see that the article was created in 2015, so I am pretty sure it is established enough that I, e.g., wouldn't want splain it to people on a conference and tout it as "this modern great thing".

It's a good tool in its own right, but... come on...

Define better.

Command Mean [s] Min [s] Max [s] Relative
gdu -npc ~ 3.714 ± 0.036 3.685 3.809 1.00
dua ~ 4.703 ± 0.011 4.691 4.721 1.27 ± 0.01
ncdu -0 -o /dev/null ~ 20.933 ± 0.113 20.757 21.073 5.64 ± 0.06
Command Mean [ms] Min [ms] Max [ms] Relative
gdu -npc ~ 643.5 ± 11.3 623.8 659.9 1.99 ± 0.12
dua ~ 389.7 ± 13.0 374.2 410.4 1.20 ± 0.08
ncdu -0 -o /dev/null ~ 1846.7 ± 11.9 1823.0 1859.9 5.71 ± 0.33

(taken from gdu's README)

If there was a better alternative, certainly you wouldn't use ncdu.

I wouldn't, if I knew about gdu before getting into an argument with two cats on the interwebz.

It simply looks to me like gdu is a better alternative to ncdu, so IMO a sensible compromise would be putting it that way - add gdu and dua-cli as alternatives to the well known ncdu.

There is also an example here: #18 (comment)

A feature which an average user of gdu likely doesn't need simply because it is 3 to 5 times faster than ncdu.

You can just read --help for both and see yourself.

No, you cannot. You cannot compare the two this way. From my PoV, one has sensible defaults, cleaner flag dictionary, and is faster. The other has these features which even I didn't knew about to this day, even after ~7 years of using it, let alone needed at any point in time. Oh, and its binary is smaller, which I don't really care about ¯_(ツ)_/¯.

So far, I found only these three feature flags aren't replicated in some way in gdu:

-o FILE                    Export scanned directory to FILE  
-f FILE                    Import scanned directory from FILE
--exclude-caches           Exclude directories containing CACHEDIR.TAG

also the fact that gdu binary is 6.2 MiB (or 4.5 MiB stripped) while static ncdu is 408 KiB

Normally I'd applaud that, but here - sorry, I don't see what that has to do with the argument. Both gdu and dua are still massively faster than ncdu for most day to day usage, and as @jtagcat said himself:

A minute saved of human time is often valued more, than 10s of compute.

MrMino avatar Jul 15 '21 12:07 MrMino

I have been using gdu and ncdu both for about more than a year.
I have to say, the argument about ncdu not being modern is extremely biased!
The recent versions of ncdu which I also use are written with Zig language.
It's very well maintained and developed. Ncdu also has a much better colour scheme in terminals by default.

However, I'm not here to say which one is BETTER! But to say, if you don't consider ncdu as a modern software, you're better off not considering gdu modern either…

However, as a complete off-topic:
I see more and more tools coming to *x world with promise of being BETTER or more MODERN; sometimes, just because of having a better look or being written in a newer language; while lacking many features in the older tools and/or lacking compatibility and/or not being POSIX conformant and/or lacking scriptable by design.

Don't get me wrong! It's obvious that look and interface design of a program is very important! But features, compatibility, standard conformant and being scriptable are very critical for all sysadmins and power users.

When choosing between a modern CLI program which is not scriptable in POSIX shells, and a CLI program that has this power but is not so-called modern, a sysadmin always chooses the second one.
And believe it or not, Linux is present 10 times more on server machines than desktop machines, or at least 10 times — if you don't consider androids, of course.

curable-online avatar Jan 31 '24 21:01 curable-online

@curable-online - happy to take the PR!

https://github.com/johnalanwoods/maintained-modern-unix

johnalanwoods avatar Feb 01 '24 09:02 johnalanwoods