Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

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

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

4 Answers

up vote 2 down vote accepted

From any directory:

du -a | sort -n -r

share|improve this answer

Use du. Try this to order the result:

du | sort -n
share|improve this answer

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

share|improve this answer

du -sk * | sort -nr | head -1

This will show the biggest directory/file in a directory in KB. Changing the head value will result in the top x files/directories.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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