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 getting more information about free disk space on Unix-like systems using the command line. Can you tell me the Linux command to check the free disk space?

Both Linux and UNIX-like systems offers two commands for checking out free disk space:

ADVERTISEMENTS

Tutorial details
DifficultyEasy (rss)
Root privilegesNo
RequirementsNone
Time1m
(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
Sample outputs that show disk space utilization:

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. The -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).

How to check free disk space in Linux

To see the file system’s complete disk usage pass the -a option:
df -a
Find out disk usage and filesystem type by passing the -T option:
df -T
Want to get used and free inodes information on Linux? Try:
df -i
Linux Checking Free Disk Space Command

du command examples for checking free and used disk space

The du command 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.

Say hello to ncdu command

ncdu (NCurses Disk Usage) is a curses-based version of the well-known ‘du’, and provides a fast way to see what directories are using your disk space. One can install with the following apt command/apt-get command:
sudo apt install ncdu
For RHEL/CentOS, first enable EPEL repo (see CentOS 8 turn on EPEL repo and RHEL 8 enable epel repo) and type the following yum command:
sudo yum install ncdu
Now just type:
ncdu
ncdu [dir] ncdu /etc/

Linux command to check disk space

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)

Conclusion

You learned how to keep track of disk utilization, and disk space with various Linux and Unix commands.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS

Comments on this entry are closed.

  • Kashif Khan Mar 18, 2009 @ 15:02

    Thanks it was very useful.

    • puli Jan 12, 2012 @ 10:13

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

  • Meharpraveen Maddineni Apr 8, 2009 @ 3:44

    Really very helpful.
    Thanks.

  • FreddieE May 20, 2009 @ 7:13

    Very useful

  • Sunil Kumar Singh Aug 20, 2009 @ 18:24

    Really very helpful

  • imtiaz ali Aug 22, 2009 @ 19:59

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

    • Veena Jul 3, 2013 @ 8:58

      fdisk -l | grep “Disk”

  • Ganesh Nepal Nov 6, 2009 @ 17:27

    Thanks, it was very helpful.

  • Ram Nov 17, 2009 @ 21:19

    It was very helped me.

  • Vinayak Feb 1, 2010 @ 2:50

    Thanks a lot….

  • Vishwanath Feb 11, 2010 @ 4:23

    Very useful…

  • Hassan Feb 11, 2010 @ 14:51

    Very good and helped me.
    Thanks
    Hassan

  • Ganesh May 6, 2010 @ 11:22

    Excellent, It really helped me alot

  • Ricardo Saracino May 21, 2010 @ 17:35

    i love it

  • S Sep 26, 2010 @ 4:37

    Thanks for this

  • kakarla.naresh Nov 25, 2010 @ 10:34

    Thanks for your gud work

  • Faizanul Islam Jul 22, 2011 @ 9:11

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

  • Puja Dash Jul 26, 2011 @ 8:48

    Thanks…made the task easy….:)

  • Odunsi Olalekan A Aug 8, 2011 @ 10:07

    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 Jun 12, 2015 @ 17:51

      by using lsblk command

  • Molik Jain Aug 30, 2011 @ 7:21

    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 Jan 31, 2017 @ 9:12

      Probably SWAP.

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

  • Erin Deliso Sep 25, 2011 @ 16:49

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

  • Vasudevan D Sep 30, 2011 @ 11:26

    Too Good article !! Keep up the work !!

  • Shripad Dec 5, 2011 @ 6:47

    Thanks a lot. It’s very useful.

  • unfa Dec 18, 2011 @ 0:11

    Simple and informative. Thanks! :)

  • sri Apr 4, 2012 @ 10:44

    Its very useful

  • Dimi Apr 11, 2012 @ 13:57

    thanks , short and useful

  • Daniel May 15, 2012 @ 8:34

    thanks for sharing!

  • Vinod Singh Jul 3, 2012 @ 7:41

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

  • santhosh Aug 31, 2012 @ 7:57

    Thanks..helped a lot

  • lin Sep 3, 2012 @ 7:21

    thanks, helps a lot.

  • Mag Dec 22, 2012 @ 14:29

    Thank for sharing. it helped a lot

  • Iqbal Shaikh Dec 26, 2012 @ 20:46

    Thanks, it was helpful

  • ari Jan 4, 2013 @ 8:29

    thanks for sharing…

  • Ganesh D Jan 4, 2013 @ 20:41

    Excellent! it really helped me a lot…

  • amin Jan 7, 2013 @ 10:21

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

  • Ab Mar 12, 2013 @ 18:41

    Thanks. Appreciated the info.

  • Arpit Garg Mar 12, 2013 @ 21:00

    Thanks a lot.

  • vel Jun 27, 2013 @ 10:29

    very useful…

  • awan Aug 26, 2013 @ 7:40

    thanks very usefull for me newbie on linux :D

  • Ranjeet Oct 31, 2013 @ 8:56

    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 Nov 12, 2013 @ 5:38

    tnx it was good

  • abdou Dec 2, 2013 @ 10:59

    so simple an helpful , amazing Rom

  • Max Mar 7, 2014 @ 7:49

    Nice summary just what i needed

  • Sam Rabophala May 30, 2014 @ 12:11

    brilliant! it really helped me a lot…

  • akansha Jul 3, 2014 @ 10:53

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

  • Raja Nagendra Kumar Aug 14, 2014 @ 1:46

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

  • Michael Vandycke Oct 3, 2014 @ 21:02

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

  • biraj Oct 15, 2014 @ 9:11

    really helped a lot.

    Cheers

  • Rajkumar Jun 12, 2015 @ 17:55

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

  • Narasimhan Jul 20, 2015 @ 0:16

    Thanks!! It was usefull

  • Khalid Hossain Sep 3, 2015 @ 6:36

    Thanks a lot!! It’s really useful.

  • shannon smith Feb 26, 2016 @ 6:34

    Thanks a lot.

  • slugbyte May 1, 2016 @ 17:01

    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!

    manual:
    https://dev.yorhel.nl/ncdu/man

    screenshots:
    https://dev.yorhel.nl/ncdu/scr

    • Serhii May 23, 2016 @ 10:08

      This is the best tool ever!

  • Prakash Jul 21, 2016 @ 11:50

    Hi

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

  • Tom Dec 15, 2017 @ 5:18

    How to view unallocated free space on a hard disk?

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.