Linux / Unix: Checking Free Disk Space

by on August 16, 2007 · 46 comments· LAST UPDATED August 16, 2007

in , ,

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?
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 46 comments… read them below or add one }

1 Kashif Khan March 18, 2009 at 3:02 pm

Thanks it was very useful.

Reply

2 puli January 12, 2012 at 10:13 am

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

Reply

3 Meharpraveen Maddineni April 8, 2009 at 3:44 am

Really very helpful.
Thanks.

Reply

4 FreddieE May 20, 2009 at 7:13 am

Very useful

Reply

5 Sunil Kumar Singh August 20, 2009 at 6:24 pm

Really very helpful

Reply

6 imtiaz ali August 22, 2009 at 7:59 pm

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

Reply

7 Veena July 3, 2013 at 8:58 am

fdisk -l | grep “Disk”

Reply

8 Ganesh Nepal November 6, 2009 at 5:27 pm

Thanks, it was very helpful.

Reply

9 Ram November 17, 2009 at 9:19 pm

It was very helped me.

Reply

10 Vinayak February 1, 2010 at 2:50 am

Thanks a lot….

Reply

11 Vishwanath February 11, 2010 at 4:23 am

Very useful…

Reply

12 Hassan February 11, 2010 at 2:51 pm

Very good and helped me.
Thanks
Hassan

Reply

13 Ganesh May 6, 2010 at 11:22 am

Excellent, It really helped me alot

Reply

14 Ricardo Saracino May 21, 2010 at 5:35 pm

i love it

Reply

15 S September 26, 2010 at 4:37 am

Thanks for this

Reply

16 kakarla.naresh November 25, 2010 at 10:34 am

Thanks for your gud work

Reply

17 Faizanul Islam July 22, 2011 at 9:11 am

Thank you very much……clear solution are always appreciated.

Reply

18 Puja Dash July 26, 2011 at 8:48 am

Thanks…made the task easy….:)

Reply

19 Odunsi Olalekan A August 8, 2011 at 10:07 am

How do i check the total size of the disk on HP ES45 server, not free space, what i mean is the total size of the disk on the said server.

Reply

20 Molik Jain August 30, 2011 at 7:21 am

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

21 Erin Deliso September 25, 2011 at 4:49 pm

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

Reply

22 Vasudevan D September 30, 2011 at 11:26 am

Too Good article !! Keep up the work !!

Reply

23 Shripad December 5, 2011 at 6:47 am

Thanks a lot. It’s very useful.

Reply

24 unfa December 18, 2011 at 12:11 am

Simple and informative. Thanks! :)

Reply

25 sri April 4, 2012 at 10:44 am

Its very useful

Reply

26 Dimi April 11, 2012 at 1:57 pm

thanks , short and useful

Reply

27 Daniel May 15, 2012 at 8:34 am

thanks for sharing!

Reply

28 Vinod Singh July 3, 2012 at 7:41 am

This is really nice article and help full to diagnose the issue in the server.

Reply

29 santhosh August 31, 2012 at 7:57 am

Thanks..helped a lot

Reply

30 lin September 3, 2012 at 7:21 am

thanks, helps a lot.

Reply

31 Mag December 22, 2012 at 2:29 pm

Thank for sharing. it helped a lot

Reply

32 Iqbal Shaikh December 26, 2012 at 8:46 pm

Thanks, it was helpful

Reply

33 ari January 4, 2013 at 8:29 am

thanks for sharing…

Reply

34 Ganesh D January 4, 2013 at 8:41 pm

Excellent! it really helped me a lot…

Reply

35 amin January 7, 2013 at 10:21 am

thanks. it was clear and useful article without any complexity.

Reply

36 Ab March 12, 2013 at 6:41 pm

Thanks. Appreciated the info.

Reply

37 Arpit Garg March 12, 2013 at 9:00 pm

Thanks a lot.

Reply

38 vel June 27, 2013 at 10:29 am

very useful…

Reply

39 awan August 26, 2013 at 7:40 am

thanks very usefull for me newbie on linux :D

Reply

40 Ranjeet October 31, 2013 at 8:56 am

Hi when I give command df -h output shows tmpfs contains 4 gigs space. Is it possible and harmless to free-up this space?

Reply

41 yaseen November 12, 2013 at 5:38 am

tnx it was good

Reply

42 abdou December 2, 2013 at 10:59 am

so simple an helpful , amazing Rom

Reply

43 Max March 7, 2014 at 7:49 am

Nice summary just what i needed

Reply

44 Sam Rabophala May 30, 2014 at 12:11 pm

brilliant! it really helped me a lot…

Reply

45 akansha July 3, 2014 at 10:53 am

How can i find out the disk size of this file system zharh10a.oracle.

Reply

46 Raja Nagendra Kumar August 14, 2014 at 1:46 am

Thank You. Just needed info for every one to simply find what they usual need in unix

Reply

Leave a Comment

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: