xref: /netbsd-src/usr.bin/du/du.1 (revision 3587d6f89c746bbb4f886219ddacd41ace480ecf)
1.\"	$NetBSD: du.1,v 1.24 2019/09/01 18:18:42 sevan Exp $
2.\"
3.\" Copyright (c) 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.\"	@(#)du.1	8.2 (Berkeley) 4/1/94
31.\"
32.Dd September 1, 2019
33.Dt DU 1
34.Os
35.Sh NAME
36.Nm du
37.Nd display disk usage statistics
38.Sh SYNOPSIS
39.Nm
40.Op Fl H | Fl L | Fl P
41.Op Fl a | Fl d Ar depth | Fl s
42.Op Fl cghikmnrx
43.Op Ar file ...
44.Sh DESCRIPTION
45The
46.Nm
47utility displays the file system usage for each file argument
48and for each directory in the file hierarchy rooted in each directory
49argument.
50If no file is specified, the block usage of the hierarchy rooted in
51the current directory is displayed.
52.Pp
53The options are as follows:
54.Bl -tag -width Ds
55.It Fl H
56Symbolic links on the command line are followed.
57(Symbolic links encountered in the tree traversal are not followed.)
58.It Fl L
59All symbolic links are followed.
60.It Fl P
61No symbolic links are followed.
62.It Fl a
63Display an entry for each file in the file hierarchy.
64.It Fl c
65Display the grand total after all the arguments have been processed.
66.It Fl d
67Display an entry files and directories
68.Ar depth
69directories deep.
70.It Fl g
71If the
72.Fl g
73flag is specified, the number displayed is the number of gigabyte
74(1024*1024*1024 bytes) blocks.
75.It Fl h
76If the
77.Fl h
78flag is specified, the numbers will be displayed in "human-readable"
79format.
80Use unit suffixes: B (Byte), K (Kilobyte), M (Megabyte), G (Gigabyte),
81T (Terabyte) and P (Petabyte).
82.It Fl i
83Output inode usage instead of blocks.
84All "human-readable" options are ignored.
85.It Fl k
86By default,
87.Nm
88displays the number of blocks as returned by the
89.Xr stat 2
90system call, i.e. 512-byte blocks.
91If the
92.Fl k
93flag is specified, the number displayed is the number of kilobyte
94(1024 bytes) blocks.
95Partial numbers of blocks are rounded up.
96.It Fl m
97If the
98.Fl m
99flag is specified, the number displayed is the number of megabyte
100(1024*1024 bytes) blocks.
101.It Fl n
102Ignore files and directories with user
103.Qq nodump
104flag
105.Pq Dv UF_NODUMP
106set.
107.It Fl r
108Generate warning messages about directories that cannot be read.
109This is the default behaviour.
110.It Fl s
111Display only the grand total for the specified files.
112.It Fl x
113Filesystem mount points are not traversed.
114.El
115.Pp
116.Nm
117counts the storage used by symbolic links and not the files they
118reference unless the
119.Fl H
120or
121.Fl L
122option is specified.
123If either the
124.Fl H
125or
126.Fl L
127options are specified, storage used by any symbolic links which are
128followed is not counted or displayed.
129The
130.Fl H ,
131.Fl L
132and
133.Fl P
134options override each other and the command's actions are determined
135by the last one specified.
136.Pp
137Files having multiple hard links are counted (and displayed) a single
138time per
139.Nm
140execution.
141.Sh ENVIRONMENT
142.Bl -tag -width BLOCKSIZE
143.It Ev BLOCKSIZE
144If the environment variable
145.Ev BLOCKSIZE
146is set, and the
147.Fl g ,
148.Fl h ,
149.Fl k ,
150and
151.Fl m
152options are not specified, the block counts will be displayed in units of that
153size block.
154.El
155.Sh EXIT STATUS
156.Ex -std
157.Sh SEE ALSO
158.Xr df 1 ,
159.Xr chflags 2 ,
160.Xr fts 3 ,
161.Xr getbsize 3 ,
162.Xr symlink 7 ,
163.Xr quot 8
164.Sh HISTORY
165A
166.Nm
167command appeared in
168.At v1 .
169