Check Disk Space Usage And File/Directory Size On Ubuntu 9.10 Karmic Koala

By Jonathan Moeller - Last updated: Friday, January 15, 2010 - Save & Share - Leave a Comment

Hard drives have gotten ever larger, but it’s still important to keep disk space usage under control. If you’re using a netbook with a small solid-state hard drive, then keeping disk usage under tight control is especially important. Fortunately, Ubuntu 8.10 has a number of easy Terminal commands for taking a quick look at your disk usage.

The first command is df, which will produce an output like this:

This will show you the various filesystems on your computer, along with the percentage currently used. However, the numbers shown are in 1k blocks, which may be difficult to read if you’re not used to it. Using df -h will produce this output instead:

The sizes are sorted into gigabytes, megabytes, and kilobytes, making it much easier to read.

You can also use a Terminal command to check the size of an individual directory. For instance, if you wanted to check the size of your Documents directory, you would use this command:

du -hs Documents

This will give you the combined size of your Documents folder, along with any subfolders.

-JM

Posted in Linux • • Top Of Page

Write a comment