xref: /freebsd/bin/df/df.1 (revision 783d3ff6)
1.\"-
2.\" Copyright (c) 1989, 1990, 1993
3.\"	The Regents of the University of California.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd March 29, 2023
30.Dt DF 1
31.Os
32.Sh NAME
33.Nm df
34.Nd display free disk space
35.Sh SYNOPSIS
36.Nm
37.Op Fl -libxo
38.Op Fl b | g | H | h | k | m | P
39.Op Fl acilnT
40.Op Fl \&,
41.Op Fl t Ar type
42.Op Ar file | filesystem ...
43.Sh DESCRIPTION
44The
45.Nm
46utility
47displays statistics about the amount of free disk space on the specified
48mounted
49.Ar file system
50or on the file system of which
51.Ar file
52is a part.
53By default block counts are displayed with an assumed block size of
54512 bytes.
55If neither a file or a file system operand is specified,
56statistics for all mounted file systems are displayed
57(subject to the
58.Fl t
59option below).
60.Pp
61The following options are available:
62.Bl -tag -width indent
63.It Fl -libxo
64Generate output via
65.Xr libxo 3
66in a selection of different human and machine readable formats.
67See
68.Xr xo_parse_args 3
69for details on command line arguments.
70.It Fl a
71Show all mount points, including those that were mounted with the
72.Dv MNT_IGNORE
73flag.
74This is implied for file systems specified on the command line.
75.It Fl b
76Explicitly use 512 byte blocks, overriding any
77.Ev BLOCKSIZE
78specification from the environment.
79This is the same as the
80.Fl P
81option.
82The
83.Fl k
84option overrides this option.
85.It Fl c
86Display a grand total.
87.It Fl g
88Use 1073741824 byte (1 Gibibyte) blocks rather than the default.
89This overrides any
90.Ev BLOCKSIZE
91specification from the environment.
92.It Fl h
93.Dq Human-readable
94output.
95Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
96Pebibyte (based on powers of 1024) in order to reduce the number of
97digits to four or fewer.
98.It Fl H , Fl Fl si
99Same as
100.Fl h
101but based on powers of 1000.
102.It Fl i
103Include statistics on the number of free and used inodes.
104In conjunction with the
105.Fl h
106or
107.Fl H
108options, the number of inodes is scaled by powers of 1000.
109In case the filesystem has no inodes then
110.Sq -
111is displayed instead of the usage percentage.
112.It Fl k
113Use 1024 byte (1 Kibibyte) blocks rather than the default.
114This overrides the
115.Fl P
116option and any
117.Ev BLOCKSIZE
118specification from the environment.
119.It Fl l
120Select a locally-mounted file system for display.
121If used in combination with the
122.Fl t Ar type
123option, file system types will be added or excluded according to the
124parameters of that option.
125.It Fl m
126Use 1048576 byte (1 Mebibyte) blocks rather than the default.
127This overrides any
128.Ev BLOCKSIZE
129specification from the environment.
130.It Fl n
131Print out the previously obtained statistics from the file systems.
132This option should be used if it is possible that one or more
133file systems are in a state such that they will not be able to provide
134statistics without a long delay.
135When this option is specified,
136.Nm
137will not request new statistics from the file systems, but will respond
138with the possibly stale statistics that were previously obtained.
139.It Fl P
140Explicitly use 512 byte blocks, overriding any
141.Ev BLOCKSIZE
142specification from the environment.
143This is the same as the
144.Fl b
145option.
146The
147.Fl k
148option overrides this option.
149.It Fl t Ar type
150Select file systems to display.
151More than one type may be specified in a comma separated list.
152The list of file system types can be prefixed with
153.Dq no
154to specify the file system types for which action should
155.Em not
156be taken.
157If used in combination with the
158.Fl l
159option, the parameters of this option will modify the list of
160locally-mounted file systems selected by the
161.Fl l
162option.
163For example, the
164.Nm
165command:
166.Bd -literal -offset indent
167df -t nonfs,nullfs
168.Ed
169.Pp
170lists all file systems except those of type NFS and NULLFS.
171The
172.Xr lsvfs 1
173command can be used to find out the types of file systems
174that are available on the system.
175.It Fl T
176Include file system type.
177.It Fl ,
178(Comma) Print sizes grouped and separated by thousands using the
179non-monetary separator returned by
180.Xr localeconv 3 ,
181typically a comma or period.
182If no locale is set, or the locale does not have a non-monetary separator, this
183option has no effect.
184.El
185.Sh ENVIRONMENT
186.Bl -tag -width BLOCKSIZE
187.It Ev BLOCKSIZE
188Specifies the units in which to report block counts.
189This uses
190.Xr getbsize 3 ,
191which allows units of bytes or numbers scaled with the letters
192.Em k
193(for multiples of 1024 bytes),
194.Em m
195(for multiples of 1048576 bytes) or
196.Em g
197(for gibibytes).
198The allowed range is 512 bytes to 1 GB.
199If the value is outside, it will be set to the appropriate limit.
200.El
201.Sh EXAMPLES
202Show human readable free disk space for all mount points including file system
203type:
204.Bd -literal -offset indent
205$ df -ahT
206Filesystem   Type        Size    Used   Avail Capacity  Mounted on
207/dev/ada1p2  ufs         213G    152G     44G    78%    /
208devfs        devfs       1.0K    1.0K      0B   100%    /dev
209/dev/ada0p1  ufs         1.8T    168G    1.5T    10%    /data
210linsysfs     linsysfs    4.0K    4.0K      0B   100%    /compat/linux/sys
211/dev/da0     msdosfs     7.6G    424M    7.2G     5%    /mnt/usb
212.Ed
213.Pp
214Show previously collected data including inode statistics except for devfs or
215linsysfs file systems.
216Note that the
217.Dq no
218prefix affects all the file systems in the list and the
219.Fl t
220option can be specified only once:
221.Bd -literal -offset indent
222$ df -i -n -t nodevfs,linsysfs
223Filesystem   1K-blocks      Used      Avail Capacity iused     ifree %iused
224Mounted on
225/dev/ada1p2  223235736 159618992   45757888    78% 1657590  27234568    6%   /
226/dev/ada0p1 1892163184 176319420 1564470712    10% 1319710 243300576    1%
227/data
228/dev/da0       7989888    433664    7556224     5%       0         0  100%
229/mnt/usb
230.Ed
231.Pp
232Show human readable information for the file system containing the file
233.Pa /etc/rc.conf :
234.Bd -literal -offset indent
235$ df -h /etc/rc.conf
236Filesystem     Size    Used   Avail Capacity  Mounted on
237/dev/ada1p2    213G    152G     44G    78%    /
238.Ed
239.Pp
240Same as above but specifying some file system:
241.Bd -literal -offset indent
242$ df -h /dev/ada1p2
243Filesystem     Size    Used   Avail Capacity  Mounted on
244/dev/ada1p2    213G    152G     44G    78%    /
245.Ed
246.Sh NOTES
247For non-Unix file systems, the reported values of used and free inodes
248may have a different meaning than that of used and available files and
249directories.
250An example is msdosfs, which in the case of FAT12 or FAT16 file systems
251reports the number of available and free root directory entries instead
252of inodes
253.Po
254where 1 to 21 such directory entries are required to store
255each file or directory name or disk label
256.Pc .
257.Sh SEE ALSO
258.Xr lsvfs 1 ,
259.Xr quota 1 ,
260.Xr fstatfs 2 ,
261.Xr getfsstat 2 ,
262.Xr statfs 2 ,
263.Xr getbsize 3 ,
264.Xr getmntinfo 3 ,
265.Xr libxo 3 ,
266.Xr localeconv 3 ,
267.Xr xo_parse_args 3 ,
268.Xr fstab 5 ,
269.Xr mount 8 ,
270.Xr pstat 8 ,
271.Xr quot 8 ,
272.Xr swapinfo 8
273.Sh STANDARDS
274With the exception of most options,
275the
276.Nm
277utility conforms to
278.St -p1003.1-2004 ,
279which defines only the
280.Fl k , P
281and
282.Fl t
283options.
284.Sh HISTORY
285A
286.Nm
287command appeared in
288.At v1 .
289.Sh BUGS
290The
291.Fl n
292flag is ignored if a file or file system is specified.
293Also, if a mount
294point is not accessible by the user, it is possible that the file system
295information could be stale.
296.Pp
297The
298.Fl b
299and
300.Fl P
301options are identical.
302The former comes from the BSD tradition, and the latter is required
303for
304.St -p1003.1-2004
305conformity.
306