Introduction
This tutorial provides an introduction to the df
command in Linux, a utility that displays information about disk space usage on mounted file systems.
This tutorial provides an introduction to the df
command in Linux, a utility that displays information about disk space usage on mounted file systems.
The df
command is a vital tool for checking disk space usage on Linux systems. It provides valuable information about the size, used space, available space, and percentage of usage for each mounted file system.
Let's begin by understanding the basic usage of the df
command. The df
command is used to display disk space usage information for mounted file systems.
Input:
df
Output:
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 20971520 128828 20842692 1% /
tmpfs 65536 0 65536 0% /dev
tmpfs 3995004 0 3995004 0% /sys/fs/cgroup
shm 65536 0 65536 0% /dev/shm
/dev/vdb 104806400 27097676 77708724 26% /etc/hosts
In this example, the df
command displays information about the disk space usage on mounted file systems.
The df
command provides options to customize the output and focus on specific information.
df [option] file
-h
: Easy-to-read display.-T
: Display file system types.-i
: Show inode information.The df
command can be configured to display a total summary of all file systems. In this example, we will show the total disk space usage summary:
Input:
df -h --total
Output:
Filesystem Size Used Avail Use% Mounted on
overlay 20G 126M 20G 1% /
tmpfs 64M 0 64M 0% /dev
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
shm 64M 0 64M 0% /dev/shm
/dev/vdb 100G 26G 75G 26% /etc/hosts
total 124G 26G 98G 21% -
The df
command can be configured to display the file system type along with disk space information. In this example, we will display the file system type for each mounted file system:
Input:
df -T
Output:
Filesystem Type 1K-blocks Used Available Use% Mounted on
overlay overlay 20971520 128872 20842648 1% /
tmpfs tmpfs 65536 0 65536 0% /dev
tmpfs tmpfs 3995004 0 3995004 0% /sys/fs/cgroup
shm tmpfs 65536 0 65536 0% /dev/shm
/dev/vdb xfs 104806400 27097876 77708524 26% /etc/hosts
You can use the df
command to display information about inodes, the data structures on a file system that store information about files and directories. In this example, we will show inodes information for each mounted file system:
Input:
df -i
Output:
Filesystem Inodes IUsed IFree IUse% Mounted on
overlay 52428800 900951 51527849 2% /
tmpfs 998751 205 998546 1% /dev
tmpfs 998751 17 998734 1% /sys/fs/cgroup
shm 998751 1 998750 1% /dev/shm
/dev/vdb 52428800 900951 51527849 2% /etc/hosts
The df
command is an essential tool for monitoring and managing disk space usage on Linux systems. Whether you need to display file system types, inodes information, or a total summary of disk space usage, the df
command provides valuable insights for system administrators and users alike.