Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How can I determine what is taking up so much space?

I just had an old server go belly up because it ran out of drive space. I am logged in to the shell, and I'm trying to find more unused files to remove.

Is there shell a command, script, or app that will display the largest files/folders?

share|improve this question

marked as duplicate by ewwhite, Nils, quanta, rnxrx, Michael Hampton Sep 16 '12 at 22:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers 4

This command will help you find big directories 5 levels deep. It also orders the directories by the size.

I had a similar problem long time ago where apache sessions where filling my disk and slowing down my web server.

du --max-depth=5 /* | sort -rn
share|improve this answer
    
my busybox did not have --max-depth so I had to use du -d 5 –  JP Hellemons 3 hours ago

The du command will get you this information. For example:

cd /
du -sm *
9   bin
18  boot
1   dev
6   etc
685 export
1   home
...
share|improve this answer

The largest top 10 files and directories with size in a human-readable format:

du -shx /* | sort -rh | head
share|improve this answer

You can use

du -h --max-depth=1 /

and then work your way down the filesystem till you find it.

If it's a long running system, the chances are high that it's a log file that has filled the disk. If that's the case then make sure you shutdown the process that's writing to it before archiving/deleting it as just deleting often doesn't recover the disk space.

share|improve this answer

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