df Command in Linux With Options and Examples

How to check free disk space in Linux Ubuntu. How to use df and du commands in Ubuntu Linux to check disk space in gb. Use these commands to check hard disk space via Ubuntu command line.

Using df Command

‘df’ reports the amount of disk space used and available on file systems. With no arguments, ‘df’ reports the space used and available on all currently mounted file systems (of all types). Otherwise, ‘df’ reports on the file system containing each argument FILE.

Normally the disk space is printed in units of 1024 bytes, but this can be overridden (*note Block size::). For bind mounts and without arguments, ‘df’ only outputs the statistics for that device with the shortest mount point name in the list of file systems (MTAB), i.e., it hides duplicate entries, unless the ‘-a’ option is specified.

df -h : show disk usage in human readable format

df -h shows disk space in human-readable format

‘-h’ or ‘–human-readable’ – Append a size letter to each size, such as ‘M’ for mebibytes. 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 if you prefer powers of 1000.

df -a : show complete disk usage

df -a shows the file system’s complete disk usage even if the Available field is 0

‘-a’ or ‘–all’ – Include in the listing 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.

df -T : show disk usage for filesystem

df -T shows the disk usage along with each block’s filesystem type (e.g., xfs, ext2, ext3, btrfs, etc.)

‘-T’ or ‘–print-type’ – Print each file system’s type. The types printed here are the same ones you can include or exclude with ‘-t’ and ‘-x’. The particular types printed are whatever is supported by the system.

Here are some of the common names (this list is certainly not exhaustive):

  1. ‘nfs’ – An NFS file system, i.e., one mounted over a network from another machine. This is the one type name which seems to be used uniformly by all systems.
  2. ‘ext2, ext3, ext4, xfs, btrfs…’ – A file system on a locally-mounted hard disk. (The system might even support more than one type here; Linux does.)
  3. ‘ntfs,fat’ – File systems used by MS-Windows / MS-DOS.

Note that with no arguments, ‘df’ reports the space used and available on all currently mounted file systems (of all types). Otherwise, ‘df’ reports on the file system containing each argument FILE. Also, the disk space is printed in units of 1024 bytes, but this can be overridden.

df Command in Linux With Options and Examples originally posted on Source Digit – Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos.