DF(1) General Commands Manual DF(1)

dfdisplay free disk space

df [--libxo] [-b | -g | -H | -h | -k | -m | -P] [-acIilntY] [-,] [-T type] [file | filesystem ...]

df [--libxo] [-b | -g | -H | -h | -k | -m | -P] [-acIilnY] [-,] [-T type] [-t type] [file | filesystem ...]

The df utility displays statistics about the amount of free disk space on the specified mounted file system or on the file system of which file is a part. By default block counts are displayed with an assumed block size of 512 bytes. If neither a file or a file system operand is specified, statistics for all mounted file systems are displayed (subject to the -t option below).

The following options are available:

Generate output via libxo(3) in a selection of different human and machine readable formats. See xo_parse_args(3) for details on command line arguments.
Show all mount points, including those that were mounted with the MNT_IGNORE flag. This is implied for file systems specified on the command line.
Explicitly use 512 byte blocks, overriding any BLOCKSIZE specification from the environment. This is the same as the -P option. The -k option overrides this option.
Display a grand total.
Use 1073741824 byte (1 Gibibyte) blocks rather than the default. This overrides any BLOCKSIZE specification from the environment.
“Human-readable” output. Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte (based on powers of 1024) in order to reduce the number of digits to four or fewer. This applies to the Size, Used, and Avail columns only; the iused and ifree columns will be displayed in powers of 1000.
, --si
Same as -h but based on powers of 1000.
Suppress inode counts. See -i below.
Include statistics on the number of free and used inodes. In conjunction with the -h or -H options, the number of inodes is scaled by powers of 1000. In case the filesystem has no inodes then ‘-’ is displayed instead of the usage percentage.

This option is now the default to conform to Version 3 of the Single UNIX Specification (“SUSv3”). Use -I to suppress this output.

Use 1024 byte (1 Kibibyte) blocks rather than the default. This overrides the -P option and any BLOCKSIZE specification from the environment.
Select locally-mounted file system for display. If used in combination with the -T type option, file system types will be added or excluded acccording to the parameters of that option.
Use 1048576 byte (1 Mebibyte) blocks rather than the default. This overrides any BLOCKSIZE specification from the environment.
Print out the previously obtained statistics from the file systems. This option should be used if it is possible that one or more file systems are in a state such that they will not be able to provide statistics without a long delay. When this option is specified, df will not request new statistics from the file systems, but will respond with the possibly stale statistics that were previously obtained.
Explicitly use 512 byte blocks, overriding any BLOCKSIZE specification from the environment. This is the same as the -b option. The -g and -k options override this option. In compatibility mode, this also suppresses inode counts.
type
Select file systems to display. More than one type may be specified in a comma separated list. The list of file system types can be prefixed with “no” to specify the file system types for which action should be taken. If used in combination with the -l option, the parameters of this option will modify the list of locally-mounted file systems selected by the -l option. For example, the df command:
df -T nonfs,mfs

lists all file systems except those of type NFS and MFS. The lsvfs(1) command can be used to find out the types of file systems that are available on the system.

If used with no arguments, this option is a no-op (macOS already prints the total allocated-space figures). If used with an argument, it acts like -T, but this usage is deprecated and should not be relied upon.
Include file system type.
-,
(Comma) Print sizes grouped and separated by thousands using the non-monetary separator returned by localeconv(3), typically a comma or period. If no locale is set, or the locale does not have a non-monetary separator, this option has no effect.

Specifies the units in which to report block counts. This uses getbsize(3), which allows units of bytes or numbers scaled with the letters k (for multiples of 1024 bytes), m (for multiples of 1048576 bytes) or g (for gibibytes). The allowed range is 512 bytes to 1 GB. If the value is outside, it will be set to the appropriate limit.

Show human readable free disk space for all mount points including file system type:

$ df -ahY
Filesystem     Type      Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk1s5s1 apfs     465Gi    15Gi   266Gi     6%    533k  2.8G    0%   /
devfs          devfs    194Ki   194Ki     0Bi   100%     672     0  100%   /dev
/dev/disk1s2   apfs     465Gi   3.4Gi   266Gi     2%    1.6k  2.8G    0%   /System/Volumes/Preboot
/dev/disk1s4   apfs     465Gi   3.0Gi   266Gi     2%       3  2.8G    0%   /System/Volumes/VM
/dev/disk1s6   apfs     465Gi    11Mi   266Gi     1%      33  2.8G    0%   /System/Volumes/Update
/dev/disk1s1   apfs     465Gi   177Gi   266Gi    40%    3.9M  2.8G    0%   /System/Volumes/Data

The filesystems on this machine are virtual volumes on a single partition. Therefore, the size and space available is the same for all filesystems even though the space in use is different. The capacity column shows the amount of space used by each filesystem as a percentage of the sum of space used and space available.

Show previously collected data, excluding inode information, except for the devfs file system. Note that the “no” prefix affects all the file systems in the list and the -t option can be specified only once:

$ df -l -I -n -t nodevfs
Filesystem     1K-blocks      Used Available Capacity  Mounted on
/dev/disk1s5s1 487196712  15300072 278432984     6%    /
/dev/disk1s2   487196712   3604640 278430312     2%    /System/Volumes/Preboot
/dev/disk1s4   487196712   3145748 278430312     2%    /System/Volumes/VM
/dev/disk1s6   487196712     11576 278430312     1%    /System/Volumes/Update
/dev/disk1s1   487196712 185371244 278432984    40%    /System/Volumes/Data

Show human readable information for the file system containing the file /etc/rc.common:

$ df -h /etc/rc.common
Filesystem      Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk1s1   465Gi   177Gi   266Gi    40%    3.9M  2.8G    0%   /System/Volumes/Data

Same as above but specifying some file system:

$ df -h /dev/disk1s1
Filesystem      Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk1s1   465Gi   177Gi   266Gi    40%    3.9M  2.8G    0%   /System/Volumes/Data

The "capacity" percentage is normally rounded up to the next higher integer. In legacy mode, it is rounded down to the next lower integer.

When the -P option and the -k option are used together, sizes are reported in 1024-byte blocks.

The -t option is normally a no-op (macOS already prints the total allocated-space figures). In legacy mode, it is equivalent to -T.

For more information about legacy mode, see compat(5).

lsvfs(1), quota(1), fstatfs(2), getfsstat(2), statfs(2), getbsize(3), getmntinfo(3), libxo(3), localeconv(3), xo_parse_args(3), compat(5), fstab(5), mount(8), pstat(8), quot(8), swapinfo(8)

With the exception of most options, the df utility conforms to IEEE Std 1003.1-2004 (“POSIX.1”), which defines only the -k, -P and -t options.

A df command appeared in Version 1 AT&T UNIX.

The -n flag is ignored if a file or file system is specified. Also, if a mount point is not accessible by the user, it is possible that the file system information could be stale.

The -b and -P options are identical. The former comes from the BSD tradition, and the latter is required for IEEE Std 1003.1-2004 (“POSIX.1”) conformity.

February 22, 2023 Mac OS X 12