Subject: bug#20936: suggestion for a 'wart-ish' extension off of 'sort'

From: Linda Walsh <[email-masked]>
Date: Tue, 30 Jun 2015 02:35:17 -0700

On 6/30/2015 12:46 AM, Erik Auerswald wrote:
>
>>> du -sh *|sort -h|tail
> Why not use 'du -shc * | sort -h | tail -n11'?
> The total produced by du will sort after all the individual parts.
Good idea  -- didn't know about '-c', but two things, 1 troubling,
the other a confusion.  If you have a dir named 'total' it can be 
slightly confusing:

Ishtar:/tmp/dutest> du -shc * |sort -h|tail
1.5M    sperl,v
3.6M    total
5.0M    total
Ishtar:/tmp/dutest> du -sh * |hsort -s|tail
1.5M    sperl,v
3.6M    total
----    -----
5.1M    TOTAL

But more a more obvious problem is 'du -shc' seems to be coming up with
the wrong number -- i.e. 1.5+3.6 = 5.1, not 5.0.

In my original example, it's off by more:

Ishtar:linux/linux-4.1.0> du -sch *|sort -h|tail
6.7M    kernel
8.4M    tools
26M     net
29M     sound
30M     Documentation
31M     include
37M     fs
128M    arch
330M    drivers
645M    total
Ishtar:linux/linux-4.1.0> du -sh *|hsort -s|tail
8.4M    tools
26M     net
29M     sound
30M     Documentation
31M     include
37M     fs
128M    arch
330M    drivers
----    -----
649.4M  TOTAL