≡ Menu

Linux / Unix: Checking Free Disk Space

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 on a Unix-like systems using command line.

Both Linux and UNIX-like systems 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
$ df -k

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

The 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, enter:
$ du -sh
Sample outputs:

Fig.01: Unix df and du command outputs from my FreeBSD server

Fig.01: Unix df and du command outputs from my FreeBSD server

The -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 the ssh based session. Linux and UNIX-like oses comes with KDE and Gnome desktop system. You will find Free Disk Space Applet located under GUI menus. Here is a sample from Fedora Linux version 22 system:

(click to enlarge)

See also

  1. Shell script to watch the disk space
  2. Why command df and du reports different output?
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 57 comments… add one }
  • Kashif Khan March 18, 2009, 3:02 pm

    Thanks it was very useful.

    • puli January 12, 2012, 10:13 am

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

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

    Really very helpful.

  • FreddieE May 20, 2009, 7:13 am

    Very useful

  • Sunil Kumar Singh August 20, 2009, 6:24 pm

    Really very helpful

  • imtiaz ali August 22, 2009, 7:59 pm

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

    • Veena July 3, 2013, 8:58 am

      fdisk -l | grep “Disk”

  • Ganesh Nepal November 6, 2009, 5:27 pm

    Thanks, it was very helpful.

  • Ram November 17, 2009, 9:19 pm

    It was very helped me.

  • Vinayak February 1, 2010, 2:50 am

    Thanks a lot….

  • Vishwanath February 11, 2010, 4:23 am

    Very useful…

  • Hassan February 11, 2010, 2:51 pm

    Very good and helped me.

  • Ganesh May 6, 2010, 11:22 am

    Excellent, It really helped me alot

  • Ricardo Saracino May 21, 2010, 5:35 pm

    i love it

  • S September 26, 2010, 4:37 am

    Thanks for this

  • kakarla.naresh November 25, 2010, 10:34 am

    Thanks for your gud work

  • Faizanul Islam July 22, 2011, 9:11 am

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

  • Puja Dash July 26, 2011, 8:48 am

    Thanks…made the task easy….:)

  • Odunsi Olalekan A August 8, 2011, 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.

    • rajkuamar June 12, 2015, 5:51 pm

      by using lsblk command

  • Molik Jain August 30, 2011, 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.

    • Aquaholic January 31, 2017, 9:12 am

      Probably SWAP.

      Also, yes, I replied to you 5 years too late.

  • Erin Deliso September 25, 2011, 4:49 pm

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

  • Vasudevan D September 30, 2011, 11:26 am

    Too Good article !! Keep up the work !!

  • Shripad December 5, 2011, 6:47 am

    Thanks a lot. It’s very useful.

  • unfa December 18, 2011, 12:11 am

    Simple and informative. Thanks! :)

  • sri April 4, 2012, 10:44 am

    Its very useful

  • Dimi April 11, 2012, 1:57 pm

    thanks , short and useful

  • Daniel May 15, 2012, 8:34 am

    thanks for sharing!

  • Vinod Singh July 3, 2012, 7:41 am

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

  • santhosh August 31, 2012, 7:57 am

    Thanks..helped a lot

  • lin September 3, 2012, 7:21 am

    thanks, helps a lot.

  • Mag December 22, 2012, 2:29 pm

    Thank for sharing. it helped a lot

  • Iqbal Shaikh December 26, 2012, 8:46 pm

    Thanks, it was helpful

  • ari January 4, 2013, 8:29 am

    thanks for sharing…

  • Ganesh D January 4, 2013, 8:41 pm

    Excellent! it really helped me a lot…

  • amin January 7, 2013, 10:21 am

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

  • Ab March 12, 2013, 6:41 pm

    Thanks. Appreciated the info.

  • Arpit Garg March 12, 2013, 9:00 pm

    Thanks a lot.

  • vel June 27, 2013, 10:29 am

    very useful…

  • awan August 26, 2013, 7:40 am

    thanks very usefull for me newbie on linux :D

  • Ranjeet October 31, 2013, 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?

  • yaseen November 12, 2013, 5:38 am

    tnx it was good

  • abdou December 2, 2013, 10:59 am

    so simple an helpful , amazing Rom

  • Max March 7, 2014, 7:49 am

    Nice summary just what i needed

  • Sam Rabophala May 30, 2014, 12:11 pm

    brilliant! it really helped me a lot…

  • akansha July 3, 2014, 10:53 am

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

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

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

  • Michael Vandycke October 3, 2014, 9:02 pm

    Thank you, loved it,
    clean clean clean and clean,
    love u

  • biraj October 15, 2014, 9:11 am

    really helped a lot.


  • Rajkumar June 12, 2015, 5:55 pm

    For total hard disk size fdisk -l | grep Disk use this command

  • Narasimhan July 20, 2015, 12:16 am

    Thanks!! It was usefull

  • Khalid Hossain September 3, 2015, 6:36 am

    Thanks a lot!! It’s really useful.

  • shannon smith February 26, 2016, 6:34 am

    Thanks a lot.

  • slugbyte May 1, 2016, 5:01 pm

    try ncdu!

    If you have privileges to install binarys on your system time and are frequently going to be looking at your disk usage ncdu is an extreemly fast ncurses tool for exploring disk usage and much easier to use than du!



    • Serhii May 23, 2016, 10:08 am

      This is the best tool ever!

  • Prakash July 21, 2016, 11:50 am


    Thanks, how to split it user wise. Like, I want which user uses how much of the space.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , ,