Linux df Command
The Linux df (disk free) command is used to display statistics on disk usage of file systems on a Linux system.
Syntax
df [options]... [FILE]...
-a, --all
Include all file systems with 0 Blocks--block-size={SIZE}
Use Blocks of size {SIZE}-h, --human-readable
Display sizes in human-readable format (default is without this option)-H, --si
Similar to-h
, but uses 1000 as the unit instead of 1024-i, --inodes
List inode information instead of used blocks-k, --kilobytes
Equivalent to--block-size=1024
-l, --local
Limit listing to local file systems-m, --megabytes
Equivalent to--block-size=1048576
--no-sync
Do not sync before getting information (default)-P, --portability
Use POSIX output format--sync
Sync before getting information-t, --type=TYPE
Limit listing to file systems of type TYPE-T, --print-type
Display type of file system-x, --exclude-type=TYPE
Exclude file systems of type TYPE-v
(ignored)--help
Display help information and exit--version
Output version information and exit
Example
Display disk usage statistics of file systems:
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 29640780 4320704 23814388 16% /
udev 1536756 4 1536752 1% /dev
tmpfs 617620 888 616732 1% /run
none 5120 0 5120 0% /run/lock
none 1544044 156 1543888 1% /run/shm
The first column specifies the file system name, the second column specifies the total memory in 1K blocks (1024 bytes each). The Used and Available columns specify the amount of memory in use and available, respectively.
The Use% column specifies the percentage of memory in use, and the last column "Mounted on" specifies the mount point of the file system.
df can also display disk usage information for a specific file system:
# df test
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 29640780 4320600 23814492 16% /
The output of the df command with the -i
option displays inode information instead of block usage:
df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda6 1884160 261964 1622196 14% /
udev 212748 560 212188 1% /dev
tmpfs 216392 477 215915 1% /run
none 216392 3 216389 1% /run/lock
none 216392 8 216384 1% /run/shm
Display all information:
# df --total
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 29640780 4320720 23814372 16% /
udev 1536756 4 1536752 1% /dev
tmpfs 617620 892 616728 1% /run
none 5120 0 5120 0% /run/lock
none 1544044 156 1543888 1% /run/shm
total 33344320 4321772 27516860 14%
We see at the end of the output, an additional line is included, showing the totals for each column.
The -h option, which can be used to produce human-readable format of the df command's output:
df -h
Filesystem Size Used Avail Use% Mounted on /dev/sda6 29G 4.2G 23G 16% / udev 1.5G 4.0K 1.5G 1% /dev tmpfs 604M 892K 603M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1.5G 156K 1.5G 1% /run/shm ```
We can see that the output displays numbers in the form of 'G' (gigabytes), "M" (megabytes), and "K" (kilobytes).
This makes the output easier to read and understand, thus making the display readable. Note that the name of the second column has also changed to "Size" for readability.