Monday, June 2, 2008

Find your most sized files

It is very easy with 'find' unix tool:


$ find / -size +100000k -exec ls -lh '{}' \;

1 comments:

Anonymous said...

I suggest you to improve your trick to be human readable style:

Syntax for RedHat / CentOS / Fedora Linux

$ find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Syntax for Debian / Ubuntu Linux
$ find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

You can use this trick to do it more graphical, very usefull for reporting to bosess.

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);}'

Other trick with find (linux)

find . -xdev -printf '%s %p\n' |sort -nr|head -20

And Last but not least you must remember that you can find the largest files in a directory with ls command. (linux)

ls -lS | head -10

eres un melon^3