df command in Linux with examples
This article is a follow up to the previous 90 Linux Commands frequently used by Linux Sysadmins post. Every week, as time allows, I will publish articles on the ~ 90 commands geared toward Linux sysadmins and Linux power users.
Use the df command when you need to know how much space is available on a particular file system or to see an overview of mounted files systems.
df command in Linux and other Unix-like systems.
The df command (short for disk free) is used to show the amount of free disk space available on Linux and other Unix-like systems and to understand the filesystems that have been mounted.
df
displays the amount of free space on the file system containing each file name argument. If no filename is provided, the free space on all currently mounted file systems is displayed.
df
with no arguments and df -i
(show free inodes) output.
df columns
Filesystem
The name of the disk partition.
Size
The total size of the file system.
used
The total amount of space allocated to existing files in the file system.
Available
The total amount of space available within the file system.
Percentage used
The percentage of the available space that currently allocated to all files on the file system.
Mounted on
The directory in which the file system appears.
df command examples
To display all filesystems and their disk usage, use:
df
To show all filesystems and their disk usage in human-readable form, use:
df -h
To show the filesystem and its disk usage containing the given file or directory, use:
df /path/to/directory_or_file
To display statistics on the number of free inodes, use:
df -i
To show filesystems but exclude the specified type, use:
df -x tmpfs
df command useful reading: