Linux Command - df

df - report file system disk space usage.

Syntax

1
df [OPTION]... [FILE]...

Options

Option Description
-a include dummy file systems
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)
-H, --si print sizes in powers of 1000 (e.g., 1.1G)
-i, --inodes list inode information instead of block usage
-k like –block-size=1K
-P, –portability use the POSIX output format
-t, –type=TYPE limit listing to file systems of type TYPE
-T, –print-type print file system type
-x exclude a file system type
--total produce a grand total
--help display help info

Examples

Display all file systems and their disk usage in human readable form

1
df -h --total

Sample output

1
2
3
4
5
6
7
8
9
10
11
Filesystem      Size  Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 788M 1.4M 787M 1% /run
/dev/sda2 228G 66G 151G 31% /
tmpfs 3.9G 147M 3.8G 4% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop0 89M 89M 0 100% /snap/core/7396
/dev/sda1 511M 7.6M 504M 2% /boot/efi
tmpfs 788M 16K 788M 1% /run/user/1000
total 242G 67G 164G 29% -

Exclude a file system type
display file system excluding tmpfs

1
2
3
4
5
6
7
$ df -h -T --total -x tmpfs
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 3.9G 0 3.9G 0% /dev
/dev/sda2 ext4 228G 66G 151G 31% /
/dev/loop0 squashfs 89M 89M 0 100% /snap/core/7396
/dev/sda1 vfat 511M 7.6M 504M 2% /boot/efi
total - 233G 67G 155G 30% -

Display all file systems and their disk usage where the file locates

1
df /root

Reference