You are currently viewing Linux Commands – df

Linux Commands – df

  • Post author:
  • Post category:Linux

Linux Commands – df

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed du command in Linux which is used to get disk space utilization of files and directories.

https://cloudaffaire.com/linux-commands-du/

In this blog post, we will discuss df command in Linux. df command is used to get file system disk space usage. df command without any argument prints the current disk space usage of file systems. You can also specify a file system as an argument to get a specific file system disk space usage. df command can be used to print the below information about the file system.

  • source: The source of the mount point, usually a device.
  • fstype: File system type.
  • itotal: Total number of inodes.
  • iused: Number of used inodes.
  • iavail: Number of available inodes.
  • ipcent: Percentage of IUSED divided by ITOTAL.
  • size: Total number of blocks.
  • used: Number of used blocks.
  • avail: Number of available blocks.
  • pcent: Percentage of USED divided by SIZE.
  • file: The file name if specified on the command line.
  • target: The mount point.

Linux Commands – df:

df command without any arguments prints the current file systems disk space usage. By default, the disk space is printed in units of 1024 bytes, but this can be overridden block size option and source, size, used, avail, pcent, target columns are returned. You can also get a specific file system disk space usage by passing it as an argument to df command.

You can use df -a or –all options to print all file systems (including dummy, duplicate, or inaccessible file systems which are omitted by default). Dummy file systems are typically special purpose pseudo file systems such as ‘/proc’, with no associated storage. Duplicate file systems are local or remote file systems that are mounted at separate locations in the local file hierarchy, or bind mounted locations. Inaccessible file systems are those which are mounted but subsequently over-mounted by another file system at that point, or otherwise inaccessible due to permissions of the mount point, etc.

You can use df -h or –human-readable or -H options to print the size in a human-readable format. In a human-readable format, a size letter to each size, such as ‘M’ for mebibytes is appended to the size. Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes. This option is equivalent to ‘–block-size=human-readable’. Use the ‘–si’ option or -H option if you prefer powers of 1000.

You can use df -B SIZE or –block-size=SIZE options to scale sizes by SIZE before printing them. You can define SIZE in integers (1,1024 etc. or 1,1000 etc. unit in bytes) or in characters (K, M, G, T, P, E, Z, Y, si). You can also use du -k or -m options to display the size in KB or MB. You can also used predefined block size using -k for KB and -m for MB.

You can use df –total options to print a grand total of all arguments after all arguments have been processed. This can be used to find out the total disk size, usage, and available space of all listed devices.

You can use df -i or –inodes options to list inode usage information instead of block usage. An inode (short for index node) contains information about a file such as its owner, permissions, timestamps, and location on the disk.

You can use df –output or –output=FIELD_LIST options to output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted. FIELD_LIST is a comma-separated list of columns to be included in df command output and therefore effectively controls the order of output columns. Each field can thus be used at the place of choice, but yet must only be used once.

You can use df –direct option to not resolve mount point and show statistics directly for a file. It can be especially useful for NFS mount points if there is a boundary between two storage policies behind the mount point.

You can use df -l or –local options to limit the listing to local file systems. By default, remote file systems are also listed.

You can use df –sync option to invoke the sync system call before getting any usage data. On some systems (notably SunOS), doing this yields more up to date results, but in general this option makes ‘df’ much slower, especially when there are many or very busy file systems.

You can use df -T or –print-type options to print file system type.

You can use df -t or –type=TYPE options to limit the listing to file systems of type TYPE.

You can use df -x or –exclude-type=TYPE options to limit the listing to file systems, not of type TYPE.

Hope you have enjoyed this article. In the next blog post, we will discuss free command in Linux.