How to Check Disk Space and Directory Space in Linux

Submitted by kai on Thu, 2009-03-26 10:21. ::

Surprisingly, I often run into the problem of running out of disk space in Linux.

Here are some simple commands to check what consumes the most space:

  • "df -k" shows the percentage of disk consumption for each partition
  • "du --max-depth 1 -h /" shows how much space each directory under "/" consumes in megabytes
  • "du -sm * | sort -n" does the same thing as the previous command

stackoverflow has a good discussion as well.

Post new comment



The content of this field is kept private and will not be shown publicly.


*

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • WikiText is converted to HTML (supported WikiText formatting will show in the long tip format).
Verify comment authorship
Captcha Image: you will need to recognize the text in it.
*
Please type in the letters/numbers that are shown in the image above.