Linux / Unix: Checking Free Disk Space

by Vivek Gite on August 16, 2007 · 21 comments

Q. How do I check free disk space in Linux or UNIX operating system? I've migrated from Windows NT to Linux and looking forward to get more information about free disk space.

A. Both Linux and UNIX offers two commands for checking out free disk space:

(a) df command : Report file system disk space usage

(b) du command : Estimate file space usage

df command examples - to check free disk space

Type df -h or df -k to list free disk space:
$ df -h
OR
$ df -k
Output:

Filesystem             Size   Used  Avail Use% Mounted on
/dev/sdb1               20G   9.2G   9.6G  49% /
varrun                 393M   144k   393M   1% /var/run
varlock                393M      0   393M   0% /var/lock
procbususb             393M   123k   393M   1% /proc/bus/usb
udev                   393M   123k   393M   1% /dev
devshm                 393M      0   393M   0% /dev/shm
lrm                    393M    35M   359M   9% /lib/modules/2.6.20-15-generic/volatile
/dev/sdb5               29G   5.4G    22G  20% /media/docs
/dev/sdb3               30G   5.9G    23G  21% /media/isomp3s
/dev/sda1              8.5G   4.3G   4.3G  51% /media/xp1
/dev/sda2               12G   6.5G   5.2G  56% /media/xp2
/dev/sdc1               40G   3.1G    35G   9% /media/backup

he df utility displays statistics about the amount of free disk space on the specified file system or on the file system of which file is a part. Values are displayed in 512-byte per block counts. -H option is called as "Human-readable" output. It use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the number of digits to four or fewer using base 10 for sizes i.e. you see 30G (30 Gigabyte).

du command examples

du shows how much space one ore more files or directories is using.
$ du -sh
103M

-s option summarize the space a directory is using and -h option provides "Human-readable" output.

GUI program

Above programs are good if GUI is not installed or you are working with remote system over ssh. Linux / UNIX comes with KDE and Gnome desktop system. You will find Free Disk Space Applet located under GUI menus.

See also

  1. Shell script to watch the disk space
  2. Why command df and du reports different output?

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 21 comments… read them below or add one }

1 Kashif Khan March 18, 2009

Thanks it was very useful.

Reply

2 puli January 12, 2012

Thanks it was usefull, but sent mails to me i can learn morelly pls

Reply

3 Meharpraveen Maddineni April 8, 2009

Really very helpful.
Thanks.

Reply

4 FreddieE May 20, 2009

Very useful

Reply

5 Sunil Kumar Singh August 20, 2009

Really very helpful

Reply

6 imtiaz ali August 22, 2009

how can i check free space in my hard drive after linux instalation.

Reply

7 Ganesh Nepal November 6, 2009

Thanks, it was very helpful.

Reply

8 Ram November 17, 2009

It was very helped me.

Reply

9 Vinayak February 1, 2010

Thanks a lot….

Reply

10 Vishwanath February 11, 2010

Very useful…

Reply

11 Hassan February 11, 2010

Very good and helped me.
Thanks
Hassan

Reply

12 Ganesh May 6, 2010

Excellent, It really helped me alot

Reply

13 Ricardo Saracino May 21, 2010

i love it

Reply

14 S September 26, 2010

Thanks for this

Reply

15 kakarla.naresh November 25, 2010

Thanks for your gud work

Reply

16 Puja Dash July 26, 2011

Thanks…made the task easy….:)

Reply

17 Molik Jain August 30, 2011

yes, Its helpful, but I have a directory called /dev/sda5

and its using 40% space, and I can’t identify, what is there in it, can you tell me how to look into it.

Reply

18 Erin Deliso September 25, 2011

Another Informative article. I enjoyed it very much. Erin Deliso

Reply

19 Vasudevan D September 30, 2011

Too Good article !! Keep up the work !!

Reply

20 Shripad December 5, 2011

Thanks a lot. It’s very useful.

Reply

21 unfa December 18, 2011

Simple and informative. Thanks! :)

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 7 + 10 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: