#!/usr/bin/perl # use this script in conjuction with the command # alias ducks='du -cks * | sort -n | sizes.pl' # to find out where all your hard drive space went to for (<>) { @arry = split '\b', $_; $exp = $arry[0] ? int((log $arry[0]) / (log 1024)) : 0; $arry[0] = sprintf "%.${exp}f%s", $arry[0] / 1024 ** $exp, ('B', 'K', 'M', 'G')[$exp + 1]; print @arry; }