Determine the disk usage of a file system in Linux or Unix.

As a server administrator you will find that the df commad is very useful to find out the disk usage of a file system in Unix or Linux. Depending on the variant of Linux or Unix, the df command also may/not display the usage of all mounted folders. Below are some examples.

df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md2 279834272 27815436 237574804 11% /
/dev/md0 101018 15033 80769 16% /boot
/dev/shm 1037060 0 1037060 0% /dev/shm

The above command displays the total, used and available size.

df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md2 279834272 27815436 237574804 11% /
/dev/md0 101018 15033 80769 16% /boot
/dev/shm 1037060 0 1037060 0% /dev/shm

The -k option displays the size in kilobytes.

df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/md2 273276 27164 232007 11% /
/dev/md0 99 15 79 16% /boot
/dev/shm 1013 0 1013 0% /dev/shm

The -m option displays the size in Mega bytes.

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 267G 27G 227G 11% /
/dev/md0 99M 15M 79M 16% /boot
/dev/shm 1013M 0 1013M 0% /dev/shm

The -h option displays the size in human redable format, in this case giga bytes.

If you just wanted to display the disk usage of a specific folder, the enter the path following the command, as in the example below.

df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/md0 99M 15M 79M 16% /boot