How To Check Disk Space In Linux

See how to use the [df] command and its options to monitor your important file systems.


Most servers these days are Linux. There are many reasons for this, but I won’t go into them in this document. One of the best ways to monitor your disk space is by using the [df] command. It shows you many details, but we can customize it to show whatever you need.


The format of the [df] command is like most Linux commands.

df [options] [filename]

This is how you use it when you want to use one of its options or add a filename. You do not have to, though. It can be run by itself.


Filesystem 1K-blocks Used Available Use% Mounted on

devtmpfs 4096 0 4096 0% /dev

tmpfs 4008348 1668 4006680 1% /dev/shm

tmpfs 1603340 1808 1601532 1% /run

/dev/sda3 242534400 105449744 136550304 44% /

tmpfs 4008348 68 4008280 1% /tmp

/dev/sda3 242534400 105449744 136550304 44% /home

/dev/sda2 996780 245888 682080 27% /boot

/dev/sda1 613160 14152 599008 3% /boot/efi

tmpfs 801668 888 800780 1% /run/user/1000

This is the default, and it shows a lot of information. However, the information is not really intuitive. Seeing space in 1-k blocks can hurt the eyes! There is a remedy for this and it is the first option I want to mention.

df -h

Filesystem Size Used Avail Use% Mounted on

devtmpfs 4.0M 0 4.0M 0% /dev

tmpfs 3.9G 1.7M 3.9G 1% /dev/shm

tmpfs 1.6G 1.8M 1.6G 1% /run

/dev/sda3 232G 101G 131G 44% /

tmpfs 3.9G 68K 3.9G 1% /tmp

/dev/sda3 232G 101G 131G 44% /home

/dev/sda2 974M 241M 667M 27% /boot

/dev/sda1 599M 14M 585M 3% /boot/efi

tmpfs 783M 888K 783M 1% /run/user/1000

That is much nicer. The [-h] option means human readable. Well, more so anyway.


You can get inode information easily. This is done with the [-i] option.

df -hi

Filesystem Inodes IUsed IFree IUse% Mounted on

devtmpfs 128K 590 128K 1% /dev

tmpfs 979K 8 979K 1% /dev/shm

tmpfs 800K 1.1K 799K 1% /run

/dev/sda3 0 0 0 - /

tmpfs 1.0M 39 1.0M 1% /tmp

/dev/sda3 0 0 0 - /home

/dev/sda2 64K 107 64K 1% /boot

/dev/sda1 0 0 0 - /boot/efi

tmpfs 196K 133 196K 1% /run/user/1000

Those are the [-h] and [-i] options after our command. Just use them together and let them work their magic.

Total Space

Some entries that [df] gives could be empty or be tiny. You may not care about the details and just want the total space you have left. That is easily done. It is done with the [—total option]. Combine it with [grep] to get a single line of information. Sometimes, that is just what you want.

df -h --total|grep ^total

total 475G 202G 272G 43% -


Earlier, you might have noticed you can use a filename as an argument. This is true. Remember, in Linux, everything is a file. So, our boot partition is just a file and we can see the space in it directly.

df -h /boot

Filesystem Size Used Avail Use% Mounted on

/dev/sda2 974M 241M 667M 27% /boot

This can be done with any mount point, and it is very useful, as you can see.


There are many more things you can do with this command. Output can be customized or sent to a file. There are more options on the man page.