Tuesday, December 08, 2009

Sorting DU results

A quick 'one-liner' to sort the results of a du by size.

from: http://ubuntuforums.org/showthread.php?t=885344


sudo du -hx --max-depth=1 / | perl -e '%byte_order = ( G => 0, M => 1, K => 2 ); print map { $_->[0] } sort { $byte_order{$a->[1]} <=> $byte_order{$b->[1]} || $b->[2] <=> $a->[2] } map { [ $_, /([MGK])/, /(\d+)/ ] } <>'

1 comment:

Viagra Generika kaufen said...

Thank you for sharing that link. Helped me out a lot.