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