Quick Tip: Checking Disk And File Usage In Linux


After restoring a friends iMac last night I thought it would nice to do a quick How To on exploring usage statistics in Linux, which by extension is “Unix-like” and pretty much interchangeable.  Mac OS X is more BSD based, but Unix in nature.  This will be a simple post, but some useful commands to try out no doubt, if you don’t already know them.

 

 

du

du will check the disk usage of a given path.  If no path is specified, the current directory path will be used.  The last line of the output gives you the total size of the current directory including its subdirectories-h.  The default size notation is in K, or Kilobytes.  Below are available options you can specify after the command name itself:

  • -c will only give you the “total usage” numbers generally at the end of the typical du command.
  • -h will present the results in human readable format, in Megabytes or Gigabytes and so on.
  • ah will display in its output, not only the directories but also all the files that are present in the current directory.
  • -s  will display the summary of  the directory size
  • -S will display the summary of the directory size, excluding sub-directories

df 

df will check the free space of a given directory or drive.  This is quite useful if you are concerned you are running out of space in a given partition or folder.

  • -h will present the results in human readable format, in Megabytes or Gigabytes and so on.
  • There are other options, but generally are not used often.  Type “man df” in the Terminal for more

That’s it for this quick How-To

_professor

Advertisements

About professorkaos64

www.libregeek.org

Posted on 20130629, in Quick Tips and tagged , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

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