The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

df - report free disk space

 SYNOPSIS



df [-k][ -P|-t][file...]

 DESCRIPTION

The df utility writes the amount of available space and file slots for file systems on which the invoking user has appropriate read access. File systems are specified by the file operands; when none are specified, information is written for all file systems. The format of the default output from df is unspecified, but all space figures will be reported in 512-byte units, unless the -k option is specified. This output contains at least the file system names, amount of available space on each of these file systems, and the number of free file slots, or inodes, available; when -t is specified, the output contains the total allocated space as well.

 OPTIONS

The df utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

-k
Use 1024-byte units, instead of the default 512-byte units, when writing space figures.
-P
Produce output in the format described in the STDOUT section.
-t
Include total allocated-space figures in the output.

 OPERANDS

The following operand is supported:
file
A pathname of a file within the hierarchy of the desired file system. If a file other than a FIFO, a regular file, a directory or a special file representing the device containing the file system (for example, /dev/dsk/0s1) is specified, the results are unspecified. Otherwise, df will write the amount of free space in the file system containing the specified file operand.

 STDIN

Not used.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of df:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

When both the -k and -P options are specified, the following header line will be written (in the POSIX locale):

"Filesystem 1024-blocks Used Available Capacity Mounted on\n"

When the -P option is specified without the -k option, the following header line will be written (in the POSIX locale):


"Filesystem 512-blocks Used Available Capacity Mounted on\n"

The implementation may adjust the spacing of the header line and the individual data lines so that the information is presented in orderly columns.

The remaining output with -P will consist of one line of information for each specified file system. These lines are formatted as follows:


"%s %d %d %d %d%% %s\n", <file system name>, <total space>,
<space used>, <space free>, <percentage used>, <file system root>

In the following list, all quantities expressed in 512-byte units (1024-byte when -k is specified) will be rounded up to the next higher unit. The fields are:

<file system name>
The name of the file system, in an implementation-dependent format.
<total space>
The total size of the file system in 512-byte units. The exact meaning of this figure is implementation-dependent, but should include <space used>, <space free>, plus any space reserved by the system not normally available to a user.
<space used>
The total amount of space allocated to existing files in the file system, in 512-byte units.
<space free>
The total amount of space available within the file system for the creation of new files by unprivileged users, in 512-byte units. When this figure is less than or equal to zero, it is not possible to create any new files on the file system without first deleting others, unless the process has appropriate privileges. The figure written may be less than zero.
<percentage used>
The percentage of the normally available space that is currently allocated to all files on the file system. This is calculated using the fraction:

space used</(.xcm>space used

expressed as a percentage. This percentage may be greater than 100 if <space free> is less than zero. The percentage value is expressed as a positive integer, with any fractional result causing it to be rounded to the next highest integer.
<file system root>
The directory below which the file system hierarchy appears.

The output format is unspecified when -t is used.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

On most systems, the "name of the file system, in an implementation-dependent format" will be the special file on which the file system is mounted.

On large file systems, the calculation specified for percentage used can create huge rounding errors.

 EXAMPLES

  1. The following example writes portable information about the /usr file system:
    
    df -P /usr
    
    

  2. Assuming that /usr/src is part of the /usr file system, the following will do the same as the previous example:
    
    df -P /usr/src
    
    

 FUTURE DIRECTIONS

None.

 SEE ALSO

find.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]