Under Linux, I'm looking for a command to list the biggest file and/or the biggest directories under a directory.

link|improve this question
This should be on superuser. – supercheetah Apr 28 '11 at 13:43
feedback

migrated from stackoverflow.com Apr 28 '11 at 13:56

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 2 down vote accepted

From any directory:

du -a | sort -n -r

link|improve this answer
feedback

du --max-depth=1 /path | sort -r -k1,1n shows you one level of directories and their sizes. If one of them really sticks out (the last one on the list is the largest due to sort -r), then you rerun the command on that directory, and then keep going until you find the offending directory/file.

If all you want is the ten biggest files just do find /home -type f -exec du -s {} \; | sort -r -k1,1n | head

link|improve this answer
feedback

Use du. Try this to order the result:

du | sort -n
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.