Operations 10 min read

Mastering the Linux df Command: Quick Ways to Check Disk Usage

This guide explains how to use the Linux df command with various options to display filesystem disk space, inode usage, and filesystem types in human‑readable, kilobyte, megabyte, or gigabyte formats, and shows how to filter or exclude specific filesystem types.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering the Linux df Command: Quick Ways to Check Disk Usage

1. Check file system disk space usage

The basic df command lists each mounted filesystem with its device name, total blocks, used space, available space, and mount point.

[root@local ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2   78361192  23185840  51130588  32% /
/dev/cciss/c0d0p5   24797380  22273432   1243972  95% /home
/dev/cciss/c0d0p3   29753588  25503792   2713984  91% /data
/dev/cciss/c0d0p1       295561    21531    258770   8% /boot
tmpfs                 257476          0    257476   0% /dev/shm

2. Show all filesystem information (including virtual filesystems)

Adding the -a flag displays virtual filesystems such as proc, sysfs, and devpts alongside physical ones.

[root@local ~]# df -a
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2   78361192  23186116  51130312  32% /
proc                       0          0          0   -  /proc
sysfs                      0          0          0   -  /sys
devpts                     0          0          0   -  /dev/pts
... (other entries omitted for brevity)

3. Display sizes in human‑readable format

Use the -h option to show sizes in KiB, MiB, GiB, etc., making the output easier to understand.

[root@local ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2     75G   23G   49G  32% /
/dev/cciss/c0d0p5     24G   22G  1.2G  95% /home
/dev/cciss/c0d0p3     29G   25G  2.6G  91% /data
/dev/cciss/c0d0p1    289M   22M  253M   8% /boot
tmpfs                252M    0  252M   0% /dev/shm

4. Show information for a specific mount point

Specify a path (e.g., /home) together with -hT to get a human‑readable view that also includes the filesystem type.

[root@local ~]# df -hT /home
Filesystem Type  Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p5 ext3  24G   22G  1.2G  95% /home

5. Display sizes in 1‑kilobyte blocks

The -k (or --block-size=1K) option forces output in 1024‑byte blocks.

[root@local ~]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2   78361192  23187212  51129216  32% /
... (other entries omitted)

6. Display sizes in megabytes

Use -m to show usage in 1‑MiB blocks.

[root@local ~]# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2        76525     22644     49931  32% /
... (other entries omitted)

7. Display sizes in gigabytes

Again, -h prints sizes in gigabytes when appropriate, as shown earlier.

8. Show inode usage

The -i flag reports the number of used and free inodes for each filesystem.

[root@local ~]# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/cciss/c0d0p2  20230848  133143 20097705   1% /
... (other entries omitted)

9. Show filesystem type

Adding -T prints the type (e.g., ext3) alongside the usual size information.

[root@local ~]# df -T
Filesystem  Type   1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2 ext3 78361192 23188812 51127616  32% /
... (other entries omitted)

10. Include only specific filesystem types

Use -t TYPE to limit output to filesystems of a given type, such as ext3.

[root@local ~]# df -t ext3
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2   78361192  23190072  51126356  32% /
... (other entries omitted)

11. Exclude specific filesystem types

The -x TYPE option hides filesystems of the specified type.

[root@local ~]# df -x ext3
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                 257476          0    257476   0% /dev/shm

12. Show help information

Running df --help displays a full list of options and their meanings.

[root@local ~]# df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides, or all file systems by default.
  -a, --all               include dummy file systems
  -B, --block-size=SIZE   use SIZE-byte blocks
  -h, --human-readable   print sizes in human readable format (e.g., 1K 234M 2G)
  -i, --inodes           list inode information instead of block usage
  -k                     like --block-size=1K
  -T, --print-type       print file system type
  -t, --type=TYPE        limit listing to file systems of type TYPE
  -x, --exclude-type=TYPE  limit listing to file systems not of type TYPE
  ... (additional options omitted)
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-lineSystem Administrationdisk usagedf
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.