xref: /netbsd-src/bin/df/df.1 (revision dd75ac5b443e967e26b4d18cc8cd5eb98512bfbf)
1.\" $NetBSD: df.1,v 1.58 2022/08/09 08:13:56 wiz Exp $
2.\"
3.\" Copyright (c) 1989, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)df.1	8.2 (Berkeley) 1/13/92
31.\"
32.Dd August 8, 2022
33.Dt DF 1
34.Os
35.Sh NAME
36.Nm df
37.Nd display free disk space
38.Sh SYNOPSIS
39.Nm
40.Op Fl aclnW
41.Op Fl G | Fl bkP | Fl bfgHhikmN
42.Op Fl t Ar type
43.Oo Ar file | Ar file_system Oc Ns ...
44.Sh DESCRIPTION
45.Nm
46displays statistics about the amount of free disk space on the specified
47.Ar file_system
48or on the file system of which
49.Ar file
50is a part.
51By default, all sizes are reported in 512-byte block counts.
52If neither a file or a
53.Ar file_system
54operand is specified,
55statistics for all mounted,
56and not hidden (i.e.: not mounted with
57.Dv MNT_IGNORE ) ,
58file systems are displayed
59(subject to the
60.Fl a ,
61.Fl l
62and
63.Fl t
64options below).
65.Pp
66Note that the printed count of available blocks takes
67.Va minfree
68into account, and thus will be negative when the number of free blocks
69on the file system is less than
70.Va minfree .
71.Pp
72The following options are available:
73.Bl -tag -width Ds
74.It Fl a
75If no
76.Ar file ,
77or
78.Ar file_system
79arguments are givem, show all mount points,
80including those that were mounted with the
81.Dv MNT_IGNORE
82flag.
83Note that for file systems specified on the command
84line, that mount option is never considered.
85.It Fl b
86Show space as units of basic blocks (512 bytes).
87This is normally the default; this option can be used to
88override a conflicting setting in the environment variable
89.Ev BLOCKSIZE .
90.It Fl c
91Display a grand total for all shown mount points.
92When combined with
93.Fl f
94only the total for the mount points which otherwise
95would be included is shown, not the individual entries.
96.It Fl f
97Display only the available free space (or with
98.Fl i ,
99free inodes) in a minimal format.
100When there is to be only one line of output, only the value
101is shown, otherwise the value and the mount point,
102separated by a single space, are printed.
103For free space, the
104.Fl b ,
105.Fl g ,
106.Fl H ,
107.Fl h ,
108.Fl k
109and
110.Fl m
111options, and
112.Ev BLOCKSIZE
113are all used as normal.
114This option implies
115.Fl N
116and is incompatible with
117.Fl P
118and
119.Fl G .
120.It Fl G
121Display all the fields of the structure(s) returned by
122.Xr statvfs 2 .
123This option cannot be used with the
124.Fl f ,
125.Fl i
126or
127.Fl P
128options, and is modelled after the Solaris
129.Fl g
130option.
131This option will override the
132.Fl b ,
133.Fl g ,
134.Fl H ,
135.Fl h ,
136.Fl k
137and
138.Fl m
139options, as well as any setting of
140.Ev BLOCKSIZE .
141.It Fl g
142The
143.Fl g
144option causes size numbers to be reported in gigabytes (1024*1024*1024
145bytes).
146.It Fl h
147Use
148.Dq human-readable
149output for space data.
150Use unit suffixes: Byte, Kilobyte, Megabyte,
151Gigabyte, Terabyte, Petabyte, Exabyte in order to reduce the number of
152digits to four or less.
153.It Fl H
154As with
155.Fl h
156but using powers of 10 (1000) rather than 2 (1024).
157.It Fl i
158Include statistics on the number of free inodes.
159When combined with
160.Fl f
161only the number of free inodes is shown.
162.It Fl k
163By default, all sizes are reported in 512-byte block counts,
164unless the
165.Ev BLOCKSIZE
166environment variable is set.
167The
168.Fl k
169option causes the size numbers to be reported in kilobytes (1024 bytes).
170.It Fl l
171Display statistics only about mounted file systems with the
172.Dv MNT_LOCAL
173flag set.
174If a non-local file system is given as an argument, a
175warning is issued and no information is given on that file system.
176.It Fl m
177The
178.Fl m
179option causes size numbers to be reported in megabytes (1024*1024 bytes).
180.It Fl N
181Suppress the header line normally output.
182This option is ignored with
183.Fl G
184which has no header line to ignore,
185and with
186.Fl P
187which requires the header line to maintain
188the portable format it is designed to emulate.
189.It Fl n
190Print out the previously obtained statistics from the file systems.
191This option should be used if it is possible that one or more
192file systems are in a state such that they will not be able to provide
193statistics without a long delay.
194When this option is specified,
195.Nm
196will not request new statistics from the file systems, but will respond
197with the possibly stale statistics that were previously obtained.
198.It Fl P
199Produce output in the following portable format:
200.Pp
201The output will be preceded by the following header line:
202.Bd -literal
203"Filesystem <blksize>-blocks Used Available Capacity Mounted on\en"
204.Ed
205.Pp
206The header line is followed by data formatted as follows:
207.Bd -literal
208"%s %d %d %d %d%% %s\en", <file system name>, <total space>,
209    <space used>, <space free>, <percentage used>,
210    <file system root>
211.Ed
212.Pp
213Note that the
214.Fl i
215option may not be specified with
216.Fl P ,
217and the
218.Ar blksize
219is required to be 512 or 1024.
220.It Fl t Ar type
221Is used to indicate the actions should only be taken on
222file systems of the specified type.
223More than one type may be specified in a comma-separated list.
224The list of file system types can be prefixed with
225.Dq no
226to specify the file system types for which action should
227.Em not
228be taken.
229If a file system is given on the command line that is not of
230the specified type, a warning is issued and no information is given on
231that file system.
232.It Fl W
233Print the wedge name instead of the mounted from device for wedges.
234The wedge name is prefixed with
235.Dq NAME=
236as in
237.Xr fstab 5 .
238If the wedge information cannot be obtained for one or more
239file systems, the
240.Fl W
241option is silently ignored for those file systems.
242.El
243.Pp
244If more than one of
245.Fl b ,
246.Fl g ,
247.Fl H ,
248.Fl h ,
249.Fl k
250or
251.Fl m
252is given, the last of those specified is used.
253.Sh ENVIRONMENT
254.Bl -tag -width BLOCKSIZE
255.It Ev BLOCKSIZE
256If the environment variable
257.Ev BLOCKSIZE
258is set, and none of the
259.Fl b ,
260.Fl g ,
261.Fl H ,
262.Fl h ,
263.Fl k
264and
265.Fl m
266options are specified,
267the block counts will be displayed in units of that size block.
268.El
269.Sh SEE ALSO
270.Xr quota 1 ,
271.Xr fstatvfs 2 ,
272.Xr getvfsstat 2 ,
273.Xr statvfs 2 ,
274.Xr getbsize 3 ,
275.Xr getmntinfo 3 ,
276.Xr humanize_number 3 ,
277.Xr fs 5 ,
278.Xr fstab 5 ,
279.Xr mount 8 ,
280.Xr quot 8 ,
281.Xr tunefs 8
282.Sh HISTORY
283A
284.Nm
285utility appeared in
286.At v1 .
287The
288.Fl f
289option was added in
290.Nx 10 .
291