This post will teach you how to use the df command in Linux, including options and examples. All the below examples were tested on RHEL, CentOS, RockyLinux and Alma Linux.

Table of Contents
- What is df Command in Linux
- How to view the mounted partitions, their mount points, and amount of disk space used:
- How to display all filesystems and their disk usage in human-readable format:
- How to display the filesystem and its disk usage containing the given file or directory:
- How to display statistics of free inodes:
- How to display filesystems but exclude the specified types:
- How to list the sum of total disk space usage?
- How to list local based filesystem only?
- How to list the file system usage in MegaByte (MB)?
- How to check file system type and list the disk uses?
- How to check disk usage details for a specific file system type?
What is df Command in Linux
The df command in linux is an integrated application to find the available and disk use space on Linux servers and storage. This command is generally used by all the system administrators, as it is one of their key jobs to monitor the server and storage space.
df command in linux reports the amount of space used and available on file systems.
Syntex:
# df [option]… [file]…
How to view the mounted partitions, their mount points, and amount of disk space used:
# df
Example:
[root@TechArticles:~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb 263174212 6039072 243696984 3% / tools 497334268 297890560 199443708 60% /init none 12888212 0 12888212 0% /dev tmpfs 4096 0 4096 0% /sys/fs/cgroup none 12890644 435804 12454840 4% /run none 12890644 0 12890644 0% /run/lock none 12890644 0 12890644 0% /run/shm none 12890644 0 12890644 0% /run/user [root@TechArticles:~]#
Note: With no inputs, df shows the space utilized and available on all currently mounted file systems (of all types). Otherwise, df reports on the file system containing each argument file.
How to display all filesystems and their disk usage in human-readable format:
# df -h
Example:
[root@TechArticles:~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sdb 251G 5.8G 233G 3% / tools 475G 285G 191G 60% /init none 13G 0 13G 0% /dev tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup none 13G 426M 12G 4% /run none 13G 0 13G 0% /run/lock none 13G 0 13G 0% /run/shm none 13G 0 13G 0% /run/user
Note: You can view a list of all the outputs in “Human Readable Format” by selecting the “-h” option. You may see the results of my previous examples’ disk space usage, which are measured in difficult-to-read bytes. This example, which measures all the sizes in GB and is simple for anyone to understand, is available. It is considerably simpler to read sizes in MB, GB, and TB than in KB. The power of 1024 was employed in the human-readable (‘-h’) format.
How to display the filesystem and its disk usage containing the given file or directory:
# df path/to/file_or_directory
Example:
[root@TechArticles:~]# df /dev/sdb Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb 263174212 6039168 243696888 3% / [root@TechArticles:~]#
How to display statistics of free inodes:
# df -i
Example:
[root@TechArticles:~]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sdb 16777216 290958 16486258 2% / tools 999 -999001 1000000 - /init none 3222053 151 3221902 1% /dev tmpfs 1024 18 1006 2% /sys/fs/cgroup none 3222661 142 3222519 1% /run none 3222661 4 3222657 1% /run/lock none 3222661 1 3222660 1% /run/shm none 3222661 1 3222660 1% /run/user
Note: The ‘-i’ option will list the inode details for each filesystem.
How to display filesystems but exclude the specified types:
# df -x squashfs -x tmpfs
Example:
[root@TechArticles:~]# df -x squashfs -x tmpfs Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb 263174212 6039260 243696796 3% / tools 497334268 298088452 199245816 60% /init none 12888212 0 12888212 0% /dev drivers 497334268 298088452 199245816 60% /usr/lib/wsl/drivers lib 497334268 298088452 199245816 60% /usr/lib/wsl/lib C: 497334268 298088452 199245816 60% /mnt/c [root@TechArticles:~]#
Note: The ‘-x’ with the filesystem name/mount point name option will exclude details.
How to list the sum of total disk space usage?
# df -h --total
Example:
[root@TechArticles ~]# df -h --total Filesystem Size Used Avail Use% Mounted on devtmpfs 1.8G 0 1.8G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.9M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/mapper/rl-root 34G 5.6G 29G 17% / /dev/sda1 1014M 255M 760M 26% /boot tmpfs 374M 0 374M 0% /run/user/0 total 43G 5.9G 37G 14% -
Note: The overall disk utilization of all the file systems can be calculated by using ‘–total’ and ‘-h’.
How to list local based filesystem only?
# df -l
[root@TechArticles ~]# df -l Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 1880348 0 1880348 0% /dev tmpfs 1910684 0 1910684 0% /dev/shm tmpfs 1910684 9032 1901652 1% /run tmpfs 1910684 0 1910684 0% /sys/fs/cgroup /dev/mapper/rl-root 35339408 5826616 29512792 17% / /dev/sda1 1038336 260216 778120 26% /boot tmpfs 382136 0 382136 0% /run/user/0
Note: The “-l” option can be used to filter out the full network/remote-based file system and only list the local-based file system,
How to list the file system usage in MegaByte (MB)?
# df -m
Example:
[root@TechArticles ~]# df -m Filesystem 1M-blocks Used Available Use% Mounted on devtmpfs 1837 0 1837 0% /dev tmpfs 1866 0 1866 0% /dev/shm tmpfs 1866 9 1858 1% /run tmpfs 1866 0 1866 0% /sys/fs/cgroup /dev/mapper/rl-root 34512 5690 28822 17% / /dev/sda1 1014 255 760 26% /boot tmpfs 374 0 374 0% /run/user/0
Note: The ‘-m’ option list the output of all file systems’ disk space use in MB (megabytes).
How to check file system type and list the disk uses?
# df -Th
Example:
[root@TechArticles ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 1.8G 0 1.8G 0% /dev tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs tmpfs 1.9G 8.9M 1.9G 1% /run tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/mapper/rl-root xfs 34G 5.6G 29G 17% / /dev/sda1 xfs 1014M 255M 760M 26% /boot tmpfs tmpfs 374M 0 374M 0% /run/user/0
Note: A list of file system types can be obtained with the “-T” option. The types of file systems are displayed as “ext4,tmpfs,ext2” in the second column “TYPE” of the example above.
How to check disk usage details for a specific file system type?
# df -t xfs
Example:
[root@TechArticles ~]# df -t xfs Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/rl-root 35339408 5826616 29512792 17% / /dev/sda1 1038336 260216 778120 26% /boot
Note: The “-t” option allows us to filter the output of a particular file system. Listed above the “xfs” file system in this example.
Read Also | EX200 RHCSA Exam Questions with Solutions: Your Path to RHEL 9 Certification
In conclusion, the df command in Linux is an essential tool for monitoring disk space usage. It provides a detailed overview of your system’s storage, helping you manage resources efficiently. By mastering the df command in Linux, you can ensure your system operates smoothly and avoid potential storage-related issues.