1.\"	$OpenBSD: du.1,v 1.19 2005/04/17 12:27:23 jmc Exp $
2.\"	$NetBSD: du.1,v 1.6 1996/10/18 07:20:31 thorpej Exp $
3.\"
4.\" Copyright (c) 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	@(#)du.1	8.2 (Berkeley) 4/1/94
32.\"
33.Dd October 4, 1996
34.Dt DU 1
35.Os
36.Sh NAME
37.Nm du
38.Nd display disk usage statistics
39.Sh SYNOPSIS
40.Nm du
41.Op Fl a | s
42.Op Fl ckrx
43.Op Fl H | L | P
44.Op Ar file ...
45.Sh DESCRIPTION
46The
47.Nm
48utility displays the file system block usage for each
49.Ar file
50argument
51and for each directory in the file hierarchy rooted in each directory
52argument.
53Note that the system block usage is usually greater than
54the actual size of the file.
55If no file is specified, the block usage of the hierarchy rooted in
56the current directory is displayed.
57.Pp
58The options are as follows:
59.Bl -tag -width Ds
60.It Fl a
61Display an entry for each file in the file hierarchy.
62.It Fl c
63Display the grand total after all the arguments have been processed.
64.It Fl H
65Symbolic links on the command line are followed.
66(Symbolic links encountered in the tree traversal are not followed.)
67.It Fl k
68By default,
69.Nm
70displays the number of blocks as returned by the
71.Xr stat 2
72system call, i.e., 512-byte blocks.
73If the
74.Fl k
75flag is specified, the number displayed is the number of 1024-byte
76blocks.
77Partial numbers of blocks are rounded up.
78.It Fl L
79All symbolic links are followed.
80.It Fl P
81No symbolic links are followed.
82.It Fl r
83Generate messages about directories that cannot be read, files
84that cannot be opened, and so on.
85This is the default case.
86This option exists solely for conformance with
87.St -xpg4 .
88.It Fl s
89Display only the grand total for the specified files.
90.It Fl x
91File system mount points are not traversed.
92.El
93.Pp
94.Nm
95counts the storage used by symbolic links and not the files they
96reference unless the
97.Fl H
98or
99.Fl L
100option is specified.
101If either the
102.Fl H
103or
104.Fl L
105options are specified, storage used by any symbolic links which are
106followed is not counted or displayed.
107The
108.Fl H ,
109.Fl L ,
110and
111.Fl P
112options override each other and the command's actions are determined
113by the last one specified.
114.Pp
115Files having multiple hard links are counted (and displayed) a single
116time per
117.Nm
118execution.
119.Sh ENVIRONMENT
120.Bl -tag -width BLOCKSIZE
121.It Ev BLOCKSIZE
122Block counts will be displayed in units of this size block, unless the
123.Fl k
124option is specified.
125.El
126.Sh SEE ALSO
127.Xr df 1 ,
128.Xr fts 3 ,
129.Xr symlink 7 ,
130.Xr quot 8
131.Sh HISTORY
132A
133.Nm
134command appeared in
135.At v3 .
136