1DF(P) POSIX Programmer's Manual DF(P)
2
3
4
6 df - report free disk space
7
9 df [-k][-P|-t][file...]
10
12 The df utility shall write the amount of available space and file
13 slots for file systems on which the invoking user has appropriate read
14 access. File systems shall be specified by the file operands; when none
15 are specified, information shall be written for all file systems. The
16 format of the default output from df is unspecified, but all space fig‐
17 ures are reported in 512-byte units, unless the -k option is specified.
18 This output shall contain at least the file system names, amount of
19 available space on each of these file systems, and the number of free
20 file slots, or inodes, available; when -t is specified, the output
21 shall contain the total allocated space as well.
22
24 The df utility shall conform to the Base Definitions volume of
25 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
26
27 The following options shall be supported:
28
29 -k Use 1024-byte units, instead of the default 512-byte units, when
30 writing space figures.
31
32 -P Produce output in the format described in the STDOUT section.
33
34 -t Include total allocated-space figures in the output.
35
36
38 The following operand shall be supported:
39
40 file A pathname of a file within the hierarchy of the desired file
41 system. If a file other than a FIFO, a regular file, a direc‐
42 tory, or a special file representing the device containing the
43 file system (for example, /dev/dsk/0s1) is specified, the
44 results are unspecified. Otherwise, df shall write the amount
45 of free space in the file system containing the specified file
46 operand.
47
48
50 Not used.
51
53 None.
54
56 The following environment variables shall affect the execution of df:
57
58 LANG Provide a default value for the internationalization variables
59 that are unset or null. (See the Base Definitions volume of
60 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
61 ables for the precedence of internationalization variables used
62 to determine the values of locale categories.)
63
64 LC_ALL If set to a non-empty string value, override the values of all
65 the other internationalization variables.
66
67 LC_CTYPE
68 Determine the locale for the interpretation of sequences of
69 bytes of text data as characters (for example, single-byte as
70 opposed to multi-byte characters in arguments).
71
72 LC_MESSAGES
73 Determine the locale that should be used to affect the format
74 and contents of diagnostic messages written to standard error
75 and informative messages written to standard output.
76
77 NLSPATH
78 Determine the location of message catalogs for the processing of
79 LC_MESSAGES .
80
81
83 Default.
84
86 When both the -k and -P options are specified, the following header
87 line shall be written (in the POSIX locale):
88
89
90 "Filesystem 1024-blocks Used Available Capacity Mounted on\n"
91
92 When the -P option is specified without the -k option, the following
93 header line shall be written (in the POSIX locale):
94
95
96 "Filesystem 512-blocks Used Available Capacity Mounted on\n"
97
98 The implementation may adjust the spacing of the header line and the
99 individual data lines so that the information is presented in orderly
100 columns.
101
102 The remaining output with -P shall consist of one line of information
103 for each specified file system. These lines shall be formatted as fol‐
104 lows:
105
106
107 "%s %d %d %d %d%% %s\n", <file system name>, <total space>,
108 <space used>, <space free>, <percentage used>,
109 <file system root>
110
111 In the following list, all quantities expressed in 512-byte units
112 (1024-byte when -k is specified) shall be rounded up to the next higher
113 unit. The fields are:
114
115 <file system name>
116
117 The name of the file system, in an implementation-defined for‐
118 mat.
119
120 <total space>
121 The total size of the file system in 512-byte units. The exact
122 meaning of this figure is implementation-defined, but should
123 include <space used>, <space free>, plus any space reserved by
124 the system not normally available to a user.
125
126 <space used>
127 The total amount of space allocated to existing files in the
128 file system, in 512-byte units.
129
130 <space free>
131 The total amount of space available within the file system for
132 the creation of new files by unprivileged users, in 512-byte
133 units. When this figure is less than or equal to zero, it shall
134 not be possible to create any new files on the file system with‐
135 out first deleting others, unless the process has appropriate
136 privileges. The figure written may be less than zero.
137
138 <percentage used>
139
140 The percentage of the normally available space that is currently
141 allocated to all files on the file system. This shall be calcu‐
142 lated using the fraction:
143
144
145 <space used>/( <space used>+ <space free>)
146
147 expressed as a percentage. This percentage may be greater than 100 if
148 <space free> is less than zero. The percentage value shall be expressed
149 as a positive integer, with any fractional result causing it to be
150 rounded to the next highest integer.
151
152 <file system root>
153
154 The directory below which the file system hierarchy appears.
155
156
157 The output format is unspecified when -t is used.
158
160 The standard error shall be used only for diagnostic messages.
161
163 None.
164
166 None.
167
169 The following exit values shall be returned:
170
171 0 Successful completion.
172
173 >0 An error occurred.
174
175
177 Default.
178
179 The following sections are informative.
180
182 On most systems, the "name of the file system, in an implementation-
183 defined format" is the special file on which the file system is
184 mounted.
185
186 On large file systems, the calculation specified for percentage used
187 can create huge rounding errors.
188
190 1. The following example writes portable information about the /usr
191 file system:
192
193
194 df -P /usr
195
196 2. Assuming that /usr/src is part of the /usr file system, the follow‐
197 ing produces the same output as the previous example:
198
199
200 df -P /usr/src
201
203 The behavior of df with the -P option is the default action of the 4.2
204 BSD df utility. The uppercase -P was selected to avoid collision with a
205 known industry extension using -p.
206
207 Historical df implementations vary considerably in their default out‐
208 put. It was therefore necessary to describe the default output in a
209 loose manner to accommodate all known historical implementations and to
210 add a portable option ( -P) to provide information in a portable for‐
211 mat.
212
213 The use of 512-byte units is historical practice and maintains compati‐
214 bility with ls and other utilities in this volume of
215 IEEE Std 1003.1-2001. This does not mandate that the file system itself
216 be based on 512-byte blocks. The -k option was added as a compromise
217 measure. It was agreed by the standard developers that 512 bytes was
218 the best default unit because of its complete historical consistency on
219 System V (versus the mixed 512/1024-byte usage on BSD systems), and
220 that a -k option to switch to 1024-byte units was a good compromise.
221 Users who prefer the more logical 1024-byte quantity can easily alias
222 df to df -k without breaking many historical scripts relying on the
223 512-byte units.
224
225 It was suggested that df and the various related utilities be modified
226 to access a BLOCKSIZE environment variable to achieve consistency and
227 user acceptance. Since this is not historical practice on any system,
228 it is left as a possible area for system extensions and will be re-
229 evaluated in a future version if it is widely implemented.
230
232 None.
233
235 find
236
238 Portions of this text are reprinted and reproduced in electronic form
239 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
240 -- Portable Operating System Interface (POSIX), The Open Group Base
241 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
242 Electrical and Electronics Engineers, Inc and The Open Group. In the
243 event of any discrepancy between this version and the original IEEE and
244 The Open Group Standard, the original IEEE and The Open Group Standard
245 is the referee document. The original Standard can be obtained online
246 at http://www.opengroup.org/unix/online.html .
247
248
249
250IEEE/The Open Group 2003 DF(P)