Bash: Get largest files in a directory

So you have a partition with a ton of subdirectories and the partition is almost full and you want to see if there are large files eating up space. There is an easy command you can run to list the 10 biggest files

find /directory -printf ‘%s %p\n’ | sort -nr | head -n 10

You can change the head -n 10 to -n 20 if you want to get the 20 biggest files.

About mike
Currently works for OpenSky as a Senior Linux Admin. He has a wonderful wife Thanuja and 2 great dogs. His major side project is Photoblog.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!