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?

  • 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.
  • 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).


Listing files/folders by size in descending order;

du -sk * |sort -rn

In human readable sizes (GNU sort only);

du -sh * |sort -rh
  • 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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy