xref: /netbsd-src/bin/df/df.1 (revision 4439cfd0acf9c7dc90625e5cd83b2317a9ab8967)
1.\" $NetBSD: df.1,v 1.60 2024/08/03 05:27:58 kre 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 3, 2024
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 aclMnqW
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 given, 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
177Each
178.Ar file
179.Pq or Ar file_system
180specified as an argument must give a path to a mount point
181in the tree, at which a file system is currently mounted.
182Information for that mounted file system is, if not otherwise
183excluded, provided.
184If a
185.Ar file
186which does not name a mount point is specified,
187a warning is issued,
188and no information is given for the file system on which that
189.Ar file
190resides (unless some other
191.Ar file
192names its mount point).
193.It Fl m
194The
195.Fl m
196option causes size numbers to be reported in megabytes (1024*1024 bytes).
197.It Fl N
198Suppress the header line normally output.
199This option is ignored with
200.Fl G
201which has no header line to ignore,
202and with
203.Fl P
204which requires the header line to maintain
205the portable format it is designed to emulate.
206.It Fl n
207Print out the previously obtained statistics from the file systems.
208This option should be used if it is possible that one or more
209file systems are in a state such that they will not be able to provide
210statistics without a long delay.
211When this option is specified,
212.Nm
213will not request new statistics from the file systems, but will respond
214with the possibly stale statistics that were previously obtained.
215.It Fl P
216Produce output in the following portable format:
217.Pp
218The output will be preceded by the following header line:
219.Bd -literal
220"Filesystem <blksize>-blocks Used Available Capacity Mounted on\en"
221.Ed
222.Pp
223The header line is followed by data formatted as follows:
224.Bd -literal
225"%s %d %d %d %d%% %s\en", <file system name>, <total space>,
226    <space used>, <space free>, <percentage used>,
227    <file system root>
228.Ed
229.Pp
230Note that the
231.Fl i
232option may not be specified with
233.Fl P ,
234and the
235.Ar blksize
236is required to be 512 or 1024.
237.It Fl q
238Suppress all warning output.
239.It Fl t Ar type
240Is used to indicate the actions should only be taken on
241file systems of the specified type.
242More than one type may be specified in a comma-separated list.
243The list of file system types can be prefixed with
244.Dq no
245to specify the file system types for which action should
246.Em not
247be taken.
248If a file system is given on the command line that is not of
249the specified type, a warning is issued and no information is given on
250that file system.
251.It Fl W
252Print the wedge name instead of the mounted from device for wedges.
253The wedge name is prefixed with
254.Dq NAME=
255as in
256.Xr fstab 5 .
257If the wedge information cannot be obtained for one or more
258file systems, the
259.Fl W
260option is silently ignored for those file systems.
261.El
262.Pp
263If more than one of
264.Fl b ,
265.Fl g ,
266.Fl H ,
267.Fl h ,
268.Fl k
269or
270.Fl m
271is given, the last of those specified is used.
272.Sh ENVIRONMENT
273.Bl -tag -width BLOCKSIZE
274.It Ev BLOCKSIZE
275If the environment variable
276.Ev BLOCKSIZE
277is set, and none of the
278.Fl b ,
279.Fl g ,
280.Fl H ,
281.Fl h ,
282.Fl k
283and
284.Fl m
285options are specified,
286the block counts will be displayed in units of that size block.
287.El
288.Sh SEE ALSO
289.Xr quota 1 ,
290.Xr fstatvfs 2 ,
291.Xr getvfsstat 2 ,
292.Xr statvfs 2 ,
293.Xr getbsize 3 ,
294.Xr getmntinfo 3 ,
295.Xr humanize_number 3 ,
296.Xr fs 5 ,
297.Xr fstab 5 ,
298.Xr mount 8 ,
299.Xr quot 8 ,
300.Xr tunefs 8
301.Sh HISTORY
302A
303.Nm
304utility appeared in
305.At v1 .
306The
307.Fl f
308option was added in
309.Nx 10 .
310