df

Updated: October 28, 2024

Report free disk space (POSIX)

Syntax:

df [-ghknP] [device|directory|file]*

Runs on:

QNX Neutrino

Options:

-g
Display all statvfs() information.
-h
Display the sizes in a “human-readable” form, using bytes, KB, MB, or GB as the units.
-k
Use 1024-byte units (the default is 512-byte).
-n
Display the filesystem mountpoints and types only.
-P
Display headings for the columns. (Output conforms to the POSIX 1003.2/5.8.6.1 format.)

Description:

The df utility displays the amount of free disk space for the given devices, directories, and files.

Note: By default, df reports its figures in 512-byte units. If you specify the -k option, it uses 1024-byte units; if you specify -h, it uses bytes.

Any block counts reported by the filesystem are rounded into 512- or 1024-byte units, and df always rounds down (i.e., to reflect whole blocks available). For a filesystem that doesn't use native 512-byte (or multiples thereof) blocks, this will result in round-off errors.

Examples:

Display the sizes in 512-byte units:

$ df -P
Filesystem       512-blocks      Used Available Capacity  Mounted on
/dev/hd0t178       37190440   4378680  32811760      12%  /
/dev/hd0t177      122881088   4198452 118682636       4%  /fs/hd0-qnx6-2/
/dev/cd0                  0         0         0     100%  (/fs/cd0/)
/dev/hd0          160086528 160086528         0     100%

Display the sizes in 1024-byte units:

$ df -kP
Filesystem      1024-blocks      Used Available Capacity  Mounted on
/dev/hd0t178       18595220   2189340  16405880      12%  /
/dev/hd0t177       61440544   2099226  59341318       4%  /fs/hd0-qnx6-2/
/dev/cd0                  0         0         0     100%  (/fs/cd0/)
/dev/hd0           80043264  80043264         0     100%

Display the sizes in bytes:

$ df -hP
Filesystem             Size      Used Available Capacity  Mounted on
/dev/hd0t178            18G      2.0G       16G      12%  /
/dev/hd0t177            59G      2.0G       57G       4%  /fs/hd0-qnx6-2/
/dev/cd0                  0         0         0     100%  (/fs/cd0/)
/dev/hd0                76G       76G         0     100%
  翻译: