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.

I ran out of disk space on an ubuntu server. How can I know how the disk space is being used so I can clean up the disk / delete unnecessary files?

share|improve this question

5 Answers 5

  • df -h: will tell you space usage of all mounted filesystems.
  • du -sh: will tell you space usage of current directory.
  • du -h --max-depth=1: will tell you space usage of each directory in current directory.
share|improve this answer
2  
I like du -sh ./* to list the sizes of all the folders in the current directory. –  wag2639 Jun 17 '10 at 1:29
    
I prefer: df -PkH –  djangofan Aug 16 '11 at 23:39

Try NCurses Disk Usage. It is pretty darn usable as an end-user tool (as opposed to something a programmer might use in a script).

share|improve this answer

Listing files/folders by size in descending order;

du -sk * |sort -rn

In human readable sizes (GNU sort only);

du -sh * |sort -rh
share|improve this answer
    
answer could definitely use some explanation, it lists the files/folders by size in descending order, which I have to say is quite useful when trying to figure out what is hogging disk space. Doesn't list sizes in human readable form but still +1 –  radman Jun 17 '10 at 2:21
    
Updated original answer with suggestions from @radman –  realist Apr 17 '12 at 3:38

du is the command for the job as it will give you the disk usage.

Try to run du -sh at your root directory and then on the directories below.

Hope this helps.

share|improve this answer

a graphical program that I like is KDirStat. Someone else mentioned ncdu and it's nice. KDirStat gives you one huge overview of your entire drive.

KDirStat Homepage

share|improve this answer

Your Answer

 
discard

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