[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#582321: TAG: dirsum -- commandline directory summary


Am Thu, 20 May 2010 12:05:50 +0200
schrieb Yves-Alexis Perez <corsac@debian.org>:

> On 20/05/2010 11:21, Ron Johnson wrote:
> > hat does this do that existing tools don't?
> > 
> > $ du -Sk | sort -nr | head -n10
> > 131960    ./.Newsletters.Washington_Post/cur
> not sure dirsum can do that either, but it's painful that du itself
> can't sort, since you can't use du -h before piping to sort.

Well, newer versions of sort added the functionality you miss, citing
from the GNU coreutils manual [1]:
    Sort numerically, as per the --numeric-sort option below, and in
    addition handle IEC or SI suffixes like MiB, MB etc (Block size).
    Note a mixture of IEC and SI suffixes is not supported and will be
    flagged as an error. Also the numbers must be abbreviated
    uniformly. I.E. values with different precisions like 6000K and 5M
    will be sorted incorrectly.

This feature was introduced in GNU coreutils release 7.5, 2009-08-20 [2]

As the coreutils version in debian sid and squeeze (I couldn't verify
lenny) is newer, the following command will work:
du -sh |sort -hr

to have the largest files first. the sort(1) man page on debian
documents this behaviour.

So if it only takes one pipe and coreutils to implement the
functionality of dirsum, maybe it's not worth a package.



search for '--human-numeric-sort'

Own your own computer. Don't use Windows 7. <http://windows7sins.org>

Attachment: signature.asc
Description: PGP signature

Reply to: