Linux

Linux Disk Usage

January 26, 2009

Every now and then one of my servers will stop working because the hard drive or one of its partitions has filled up.  In almost every case it has simply been choking on a log file that grew to massive proportions, but not always.

There are a lot of linux commands that will help you track down what’s using up all your memory.  However I found that they often left me just as puzzled afterwards.  Here’s a handy one that will show you the space being used by every folder or file in the current directory and most importantly they will be sorted by size.

du -sk * | sort -n

Only registered users can comment.

  1. Much better:
    du -dh | sort -n
    Eliminates numbering the kilos and jokes like: Regular people believe that the kilobyte has 1000 bytes, the programmer KNOWS that the kilometer has 1024 meters.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.