Hi, Am Thu, 20 May 2010 12:05:50 +0200 schrieb Yves-Alexis Perez <cor...@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]: ‘-h’ ‘--human-numeric-sort’ ‘--sort=human-numeric’ 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. Cheers, Mika [1] http://www.gnu.org/software/coreutils/manual/coreutils.html#sort-invocation [2] http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=NEWS;hb=1d10eb8b1eeff9dd0fe1bbbc212e9535203acff0, search for '--human-numeric-sort' -- Own your own computer. Don't use Windows 7. <http://windows7sins.org>
signature.asc
Description: PGP signature