Bash: Get largest files in a directory

March 12, 2010    bash files large files Sys Admin

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.

comments powered by Disqus