On 4/7/25 01:49, Matteo Croce wrote:
Under Linux, add a --memory flag which allows to show cache memory usage
of files:

$ truncate -s100M file
$ du file
0       file
$ dd status=none bs=1M count=5 if=file of=/dev/null
$ du --memory --human file
10M     file
$ dd status=none bs=1M skip=30 count=5 if=file of=/dev/null
$ du --memory --human file
21M     file
$ cat file >/dev/null
$ du --memory --human file
100M    file

Thanks for the patch - with that we can discuss about something concrete.

Still, I'm personally quite reluctant about adding it due to the following
reasons:

a) the functionality is only available on GNU/Linux - as discussed already.
   https://lists.gnu.org/archive/html/coreutils/2025-03/msg00017.html

b) the du(1) utility is about file space usage on the file system.
Thus, adding code for how a file is represented in certain kernel memory
areas just because the output shall be similar to du(1) sounds quite
off to me.  With that in mind, one could also add wc(1) functionality
into du(1).

I can see that the name 'mu' - as suggested initially, see link above - would
fit quite well into the naming pattern of du(1), and (GNU/Linux) users would
learn that very fast, but as the functionality is not portable the GNU coreutils
seem the wrong place for it.

Therefore, I'm 10:90 for adding this.

Have a nice day,
Berny

Reply via email to