On Mon, Jun 03, 2024 at 07:42:17PM -0500, David Wright wrote: > On Mon 03 Jun 2024 at 18:29:17 (-0400), Greg Wooledge wrote: > > ‘-s’ > > ‘--summarize’ > > Display only a total for each argument. > > > > There's supposed to be a total *FOR EACH ARGUMENT*. There isn't. > > Try adding -l. The idea is that du is trying to avoid double-counting, > so when the subdirectories come first, those ones are "used up" by > the time it reaches the parent. When the parent is first, it's (all) > the subdirectories instead that have been "used up".
‘-l’ ‘--count-links’ Count the size of all files, even if they have appeared already (as a hard link). This documentation leaves a lot to be desired. Anyway, you are correct about the result, even if the documentation gives no realistic way to conclude such a result. hobbit:~$ printf '%s\0' "${1:-.}" "${1:-.}"/*/ | xargs -0 du -shl 684M /usr/local 81M /usr/local/bin/ 4.0K /usr/local/etc/ 4.0K /usr/local/games/ 136K /usr/local/include/ 45M /usr/local/lib/ 29M /usr/local/man/ 8.0K /usr/local/sbin/ 31M /usr/local/share/ 484M /usr/local/src/ 44M /usr/local/tcl8.6/