Little Girl's Mostly Linux Blog

DisplayDiskSpace

Display disk space

This page was last updated on July 18, 2009.

Disk Free Space

  • Use this command to check how big your drives are and how much space is used and free.
  • df -h
    • Example result:
    • Filesystem            Size  Used Avail Use% Mounted on
      /dev/sda3             292G  130G  147G  47% /
      varrun               1013M  180K 1013M   1% /var/run
      varlock              1013M     0 1013M   0% /var/lock
      udev                 1013M   44K 1013M   1% /dev
      devshm               1013M     0 1013M   0% /dev/shm
      lrm                  1013M   20M  994M   2% /lib/modules/2.6.24-23-generic/volatile
      /dev/sda1             950M  110M  793M  13% /boot
      

      Note: The -h argument makes it human readable.

Directory Size

To check the size of a specific directory, substitute the path to the directory for * in any of the commands below.

  • This command displays the size in MB of the folders and/or files in the current directory:
  • du -sm * | sort -n
    • Example result:
    • 1       draft
      1       inbox
      1       queue
      1       sent
      1       trash
      179     Saved Mail
      

      Note: Any folder or file that is 1MB or smaller will be displayed as 1.

  • This command displays the size in KB of the folders and/or files in the current directory:
  • du -sc * | sort -n
    • Example result:
    • 12      draft
      12      inbox
      12      queue
      12      sent
      192     trash
      182508  Saved Mail
      182748  total
      
  • This command displays the size in KB and MB of the folders and/or files in the current directory:
  • du -sh * | sort -n
    • Example result:
    • 12K     draft
      12K     inbox
      12K     queue
      12K     sent
      179M    Saved Mail
      192K    trash
      
  • This command displays the size in KB and MB of all the folders and or files in the current directory and all its subdirectories:
  • du -h * | sort -n


Obligatory Happy Ending

And they all lived happily ever after. The end.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Comment:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: