df is a command-line tool used to get information about disk usage. df is created under the GNU project and provided for different Linux distributions like Ubuntu, Mint, CentOS, Fedora, RHEL, SUSE, Debian, BSD, and Unix.

Getting Help About df

We can get help about df with –help parameter. Keep in mind that -h is used for formatting operation.

$ df --help

Getting Help About df

Display Information About File System With df

If we do not provide any option or parameter the df command will list all partitions and related information. We have explained the related information below the screenshot.

$ df

Display Information About File System With df

Filesystem is the mount point of filesystem

is the mount point of filesystem 1K-blocks is number of 1Kilobyteblocks

is number of 1Kilobyteblocks Used is how many of the blocks are used

is how many of the blocks are used Available is how many of the blocks are free

is how many of the blocks are free Use % is usage percentage

is usage percentage Mounted on is where the file system mounted

Display All File Systems with df

Previous examples will list only real file systems. But as we know that Linux creates a lot of pseudue file systems for its functionality. We can list all file systems even pro, sysfs. lxc related file systems are displayed too.

$ df -a

Display All File Systems with df

Display File Systems By Specifying Memory Block Size with df

The default block size is set to 1KB as we have seen before. We can change this size whatever we want. Here we change to it 100 with -B option.

$ df -B 100

Display File Systems By Specifying Memory Block Size with df

Print Size As Human Readable with df

We have not 50-100 kb of the file system. Today file systems are very huge in size and reading these sizes as kb is complex so we prefer human-readable GB sizes. We will use -h option to list a more readable format.

$ df -h

Print Size As Human Readable with df

Show Total of The File Systems with df

We can sum up the total size of the file systems with --total . At the end of the list, a new column named total added

$ df -h --total

Show Total of The File Systems with df

List Inodes Count with df

Inodes are a fundamental part of the file systems. Up to now, we have used 1K blocks but we may show the total inode numbers about file systems with -i option like below.

$ df -i

List Inodes Count with df

Print File System Type with df

File systems are We can also list file system type with df with -T option.

$ df -T

Print File System Type with df

As we see there is tmpfs,ext4,xfs file systems in the screenshot.

List Only Local File Systems with df

There may be remote or network-based file systems that are already mounted into the local Linux system. We can list only the local file system by using -l option. Remote file systems like SMB, NFS are not listed.

$ df -l

Filter Results According to File System with df

There are different types of file systems in a regular Linux system. We can filter results according to the file system. This will be provided with -t option.

$ df -t ext4

Filter Results According to File System with df

Sort File System According To Usage Percentage

We can sort the file system usage with sort command like below.

$ df -Ph | sort -nk5

Sort File System According To Percentage

Get Block Size Always in GB with df

We may want to list sizes in GB for all ways. By using -BG option df will always output GB.

$ df -BG

Get Block Size Always in GB with df