1DF(1P)                     POSIX Programmer's Manual                    DF(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       df - report free disk space
13

SYNOPSIS

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

DESCRIPTION

18       The df utility shall write the amount  of  available  space   and  file
19       slots  for file systems on which the invoking user has appropriate read
20       access. File systems shall be specified by the file operands; when none
21       are  specified,  information shall be written for all file systems. The
22       format of the default output from df is unspecified, but all space fig‐
23       ures are reported in 512-byte units, unless the -k option is specified.
24       This output shall contain at least the file  system  names,  amount  of
25       available  space on each of these file systems,  and the number of free
26       file slots, or inodes, available; when  -t  is  specified,  the  output
27       shall contain the total allocated space as well.
28

OPTIONS

30       The  df  utility  shall  conform  to  the  Base  Definitions  volume of
31       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
32
33       The following options shall be supported:
34
35       -k     Use 1024-byte units, instead of the default 512-byte units, when
36              writing space figures.
37
38       -P     Produce output in the format described in the STDOUT section.
39
40       -t     Include total allocated-space figures in the output.
41
42

OPERANDS

44       The following operand shall be supported:
45
46       file   A  pathname  of  a file within the hierarchy of the desired file
47              system.  If a file other than a FIFO, a regular file,  a  direc‐
48              tory,   or a special file representing the device containing the
49              file system  (for  example,  /dev/dsk/0s1)   is  specified,  the
50              results  are  unspecified.  Otherwise, df shall write the amount
51              of free space in the file system containing the  specified  file
52              operand.
53
54

STDIN

56       Not used.
57

INPUT FILES

59       None.
60

ENVIRONMENT VARIABLES

62       The following environment variables shall affect the execution of df:
63
64       LANG   Provide  a  default value for the internationalization variables
65              that are unset or null. (See  the  Base  Definitions  volume  of
66              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
67              ables for the precedence of internationalization variables  used
68              to determine the values of locale categories.)
69
70       LC_ALL If  set  to a non-empty string value, override the values of all
71              the other internationalization variables.
72
73       LC_CTYPE
74              Determine the locale for  the  interpretation  of  sequences  of
75              bytes  of  text  data as characters (for example, single-byte as
76              opposed to multi-byte characters in arguments).
77
78       LC_MESSAGES
79              Determine the locale that should be used to  affect  the  format
80              and  contents  of  diagnostic messages written to standard error
81              and informative messages written to standard output.
82
83       NLSPATH
84              Determine the location of message catalogs for the processing of
85              LC_MESSAGES .
86
87

ASYNCHRONOUS EVENTS

89       Default.
90

STDOUT

92       When  both  the  -k  and -P options are specified, the following header
93       line shall be written (in the POSIX locale):
94
95
96              "Filesystem 1024-blocks Used Available Capacity Mounted on\n"
97
98       When the -P option is specified without the -k  option,  the  following
99       header line shall be written (in the POSIX locale):
100
101
102              "Filesystem 512-blocks Used Available Capacity Mounted on\n"
103
104       The  implementation  may  adjust the spacing of the header line and the
105       individual data lines so that the information is presented  in  orderly
106       columns.
107
108       The  remaining  output with -P shall consist of one line of information
109       for each specified file system. These lines shall be formatted as  fol‐
110       lows:
111
112
113              "%s %d %d %d %d%% %s\n", <file system name>, <total space>,
114                  <space used>, <space free>, <percentage used>,
115                  <file system root>
116
117       In  the  following  list,  all  quantities  expressed in 512-byte units
118       (1024-byte when -k is specified) shall be rounded up to the next higher
119       unit. The fields are:
120
121       <file system name>
122
123              The  name  of the file system, in an implementation-defined for‐
124              mat.
125
126       <total space>
127              The total size of the file system in 512-byte units.  The  exact
128              meaning  of  this  figure  is implementation-defined, but should
129              include <space used>, <space free>, plus any space  reserved  by
130              the system not normally available to a user.
131
132       <space used>
133              The  total  amount  of  space allocated to existing files in the
134              file system, in 512-byte units.
135
136       <space free>
137              The total amount of space available within the file  system  for
138              the  creation  of  new  files by unprivileged users, in 512-byte
139              units. When this figure is less than or equal to zero, it  shall
140              not be possible to create any new files on the file system with‐
141              out first deleting others, unless the  process  has  appropriate
142              privileges.  The figure written may be less than zero.
143
144       <percentage used>
145
146              The percentage of the normally available space that is currently
147              allocated to all files on the file system. This shall be  calcu‐
148              lated using the fraction:
149
150
151              <space used>/( <space used>+ <space free>)
152
153       expressed  as  a percentage. This percentage may be greater than 100 if
154       <space free> is less than zero. The percentage value shall be expressed
155       as  a  positive  integer,  with  any fractional result causing it to be
156       rounded to the next highest integer.
157
158       <file system root>
159
160              The directory below which the file system hierarchy appears.
161
162
163       The output format is unspecified when -t is used.
164

STDERR

166       The standard error shall be used only for diagnostic messages.
167

OUTPUT FILES

169       None.
170

EXTENDED DESCRIPTION

172       None.
173

EXIT STATUS

175       The following exit values shall be returned:
176
177        0     Successful completion.
178
179       >0     An error occurred.
180
181

CONSEQUENCES OF ERRORS

183       Default.
184
185       The following sections are informative.
186

APPLICATION USAGE

188       On most systems, the "name of the file system,  in  an  implementation-
189       defined  format"  is  the  special  file  on  which  the file system is
190       mounted.
191
192       On large file systems, the calculation specified  for  percentage  used
193       can create huge rounding errors.
194

EXAMPLES

196        1. The  following  example  writes portable information about the /usr
197           file system:
198
199
200           df -P /usr
201
202        2. Assuming that /usr/src is part of the /usr file system, the follow‐
203           ing produces the same output as the previous example:
204
205
206           df -P /usr/src
207

RATIONALE

209       The  behavior of df with the -P option is the default action of the 4.2
210       BSD df utility. The uppercase -P was selected to avoid collision with a
211       known industry extension using -p.
212
213       Historical  df  implementations vary considerably in their default out‐
214       put. It was therefore necessary to describe the  default  output  in  a
215       loose manner to accommodate all known historical implementations and to
216       add a portable option ( -P) to provide information in a  portable  for‐
217       mat.
218
219       The use of 512-byte units is historical practice and maintains compati‐
220       bility   with   ls   and   other   utilities   in   this   volume    of
221       IEEE Std 1003.1-2001. This does not mandate that the file system itself
222       be based on 512-byte blocks. The -k option was added  as  a  compromise
223       measure.   It  was agreed by the standard developers that 512 bytes was
224       the best default unit because of its complete historical consistency on
225       System  V  (versus  the  mixed 512/1024-byte usage on BSD systems), and
226       that a -k option to switch to 1024-byte units was  a  good  compromise.
227       Users  who  prefer the more logical 1024-byte quantity can easily alias
228       df to df -k without breaking many historical  scripts  relying  on  the
229       512-byte units.
230
231       It  was suggested that df and the various related utilities be modified
232       to access a BLOCKSIZE environment variable to achieve  consistency  and
233       user  acceptance.  Since this is not historical practice on any system,
234       it is left as a possible area for system extensions  and  will  be  re-
235       evaluated in a future version if it is widely implemented.
236

FUTURE DIRECTIONS

238       None.
239

SEE ALSO

241       find
242
244       Portions  of  this text are reprinted and reproduced in electronic form
245       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
246       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
247       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
248       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
249       event of any discrepancy between this version and the original IEEE and
250       The  Open Group Standard, the original IEEE and The Open Group Standard
251       is the referee document. The original Standard can be  obtained  online
252       at http://www.opengroup.org/unix/online.html .
253
254
255
256IEEE/The Open Group                  2003                               DF(1P)
Impressum