df command shows Linux disk space information, including disk space that is used, disk space remaining, and how filesystems are mounted in Linux system.
Linux df command with examples
root@serverXX [~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda5 10321208 7003596 2793324 72% / tmpfs 4005960 20 4005940 1% /dev/shm /dev/sda1 101133 65861 30050 69% /boot /dev/sda8 904559680 259626180 598984472 31% /home /dev/sda7 1032088 76596 903064 8% /tmp /dev/sda2 20642428 16431572 3162280 84% /usr /dev/sda3 20642428 9433620 10160232 49% /var /dev/sdb1 961432904 329867956 582726908 37% /backup root@serverXX [~]#
I always use ‘df -h’ , it displays information of all file system in GB (Gigabyte).
root@serverXX [~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda5 9.9G 6.7G 2.7G 72% / tmpfs 3.9G 20K 3.9G 1% /dev/shm /dev/sda1 99M 65M 30M 69% /boot /dev/sda8 863G 248G 572G 31% /home /dev/sda7 1008M 76M 882M 8% /tmp /dev/sda2 20G 16G 3.1G 84% /usr /dev/sda3 20G 9.0G 9.7G 49% /var /dev/sdb1 917G 315G 556G 37% /backup root@serverXX [~]#
To display information of all file system usage in MB (Mega Byte) use the option as ‘df -m‘.
root@serverXX [~]# df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/sda5 10080 6840 2728 72% / tmpfs 3913 1 3913 1% /dev/shm /dev/sda1 99 65 30 69% /boot /dev/sda8 883360 253489 584999 31% /home /dev/sda7 1008 76 882 8% /tmp /dev/sda2 20159 16051 3085 84% /usr /dev/sda3 20159 9214 9922 49% /var /dev/sdb1 938900 322137 569070 37% /backup root@serverXX [~]#
The df command when used with option -i, will display Inode information.
root@serverXX [~]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda5 655360 232125 423235 36% / tmpfs 1001490 5 1001485 1% /dev/shm /dev/sda1 26208 41 26167 1% /boot /dev/sda8 57442304 3882860 53559444 7% /home /dev/sda7 65536 6655 58881 11% /tmp /dev/sda2 1310720 188125 1122595 15% /usr /dev/sda3 1310720 472598 838122 37% /var /dev/sdb1 61054976 4451860 56603116 8% /backup root@serverXX [~]#