How To Use Linux df Command?


One of the main duty of System Administrator is monitoring and checking the disk usage. According to situation take action against it. df command is used to file system disk space usage. It is practical to see disk usage in a fast and clean way.

Getting Help About df

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

Display Information About File System With df

df can list file systems in the linux like below and gives detailed info about their usage.

  • Filesystem is the mount point of filesystem
  • 1K-blocks is number of 1Kilobyteblocks
  • Used is how many of the blocks are used
  • Available is how many of the blocks are free
  • Use % is usage percentage
  • Mounted on is where the file system mounted
LEARN MORE  How To List Installed Packages In CentOS, Fedora?

Display All File Systems with df

We can list all file systems even pro, sysfs. lxc related file systems are displayed too.

Display File Systems By Specifying Memory Block Size with df

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

LEARN MORE  How To Create Thumbnail Of Image In Linux With Bash?

Print Size As Human Readable with df

We have not some kb of 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.

Show Total of The File Systems with df

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

List Inodes Count with df

Up to now we have used 1K blocks but we may show the total inode numbers about file systems with -i .

Print File System Type with df

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

LEARN MORE  Installing XFCE Desktop on Ubuntu 16.04

As we see there is tmpfs,ext4,xfs

List Only Local File Systems with df

We can list only local file system by using -l option. Remote file systems like smb, nfs are not listed.

Filter Results According to File System with df

We can filter results according to file system. This will provided with -t  option.

Sort File System According To Percentage

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

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.

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)