1.\" $NetBSD: du.1,v 1.21 2006/09/24 07:19:16 wiz 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 24, 2006 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 cghkmnrx 43.Op Ar file ... 44.Sh DESCRIPTION 45The 46.Nm 47utility displays the file system block 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 k 83By default, 84.Nm 85displays the number of blocks as returned by the 86.Xr stat 2 87system call, i.e. 512-byte blocks. 88If the 89.Fl k 90flag is specified, the number displayed is the number of kilobyte 91(1024 bytes) blocks. 92Partial numbers of blocks are rounded up. 93.It Fl m 94If the 95.Fl m 96flag is specified, the number displayed is the number of megabyte 97(1024*1024 bytes) blocks. 98.It Fl n 99Ignore files and directories with user 100.Qq nodump 101flag 102.Pq Dv UF_NODUMP 103set. 104.It Fl r 105Generate warning messages about directories that cannot be read. 106This is the default behaviour. 107.It Fl s 108Display only the grand total for the specified files. 109.It Fl x 110Filesystem mount points are not traversed. 111.El 112.Pp 113.Nm 114counts the storage used by symbolic links and not the files they 115reference unless the 116.Fl H 117or 118.Fl L 119option is specified. 120If either the 121.Fl H 122or 123.Fl L 124options are specified, storage used by any symbolic links which are 125followed is not counted or displayed. 126The 127.Fl H , 128.Fl L 129and 130.Fl P 131options override each other and the command's actions are determined 132by the last one specified. 133.Pp 134Files having multiple hard links are counted (and displayed) a single 135time per 136.Nm 137execution. 138.Sh ENVIRONMENT 139.Bl -tag -width BLOCKSIZE 140.It Ev BLOCKSIZE 141If the environment variable 142.Ev BLOCKSIZE 143is set, and the 144.Fl g , 145.Fl h , 146.Fl k , 147and 148.Fl m 149options are not specified, the block counts will be displayed in units of that 150size block. 151.El 152.Sh SEE ALSO 153.Xr df 1 , 154.Xr chflags 2 , 155.Xr fts 3 , 156.Xr getbsize 3 , 157.Xr symlink 7 , 158.Xr quot 8 159.Sh HISTORY 160A 161.Nm 162command appeared in 163.At v6 . 164