Find and list large files on Linux (or Unix, BSD, Mac OSX)

There are sev­eral ways to do this, the most preva­lent among sys admins being this:

find {/path/to/folder/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Which lists the largest files in the folder /path/to/folder. You could just use the ls com­mand too, as such:

ls -lhS

But there is a sim­pler, more effi­cient method to do this:

du -xak .|sort -n|tail -50

But the best method involves a small Perl hack that shows a very neatly laid out list­ing of largest files:

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf  ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'