19b50d902SRodney W. Grimes.\" Copyright (c) 1990, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 69b50d902SRodney W. Grimes.\" are met: 79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 89b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 119b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 139b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 149b50d902SRodney W. Grimes.\" without specific prior written permission. 159b50d902SRodney W. Grimes.\" 169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269b50d902SRodney W. Grimes.\" SUCH DAMAGE. 279b50d902SRodney W. Grimes.\" 28*b2b8fa1aSNathan Huff.Dd April 29, 2024 299b50d902SRodney W. Grimes.Dt DU 1 309b50d902SRodney W. Grimes.Os 319b50d902SRodney W. Grimes.Sh NAME 329b50d902SRodney W. Grimes.Nm du 339b50d902SRodney W. Grimes.Nd display disk usage statistics 349b50d902SRodney W. Grimes.Sh SYNOPSIS 358fe908efSRuslan Ermilov.Nm 36*b2b8fa1aSNathan Huff.Op Fl -libxo 37653fa521SGlen Barber.Op Fl Aclnx 3895a09b05SRuslan Ermilov.Op Fl H | L | P 3969739e8dSDag-Erling Smørgrav.Op Fl g | h | k | m 40653fa521SGlen Barber.Op Fl a | s | d Ar depth 41653fa521SGlen Barber.Op Fl B Ar blocksize 42f682f10cSRuslan Ermilov.Op Fl I Ar mask 43653fa521SGlen Barber.Op Fl t Ar threshold 44884bd44cSPhilippe Charnier.Op Ar 459b50d902SRodney W. Grimes.Sh DESCRIPTION 469b50d902SRodney W. GrimesThe 47884bd44cSPhilippe Charnier.Nm 489b50d902SRodney W. Grimesutility displays the file system block usage for each file argument 499b50d902SRodney W. Grimesand for each directory in the file hierarchy rooted in each directory 509b50d902SRodney W. Grimesargument. 519b50d902SRodney W. GrimesIf no file is specified, the block usage of the hierarchy rooted in 529b50d902SRodney W. Grimesthe current directory is displayed. 539b50d902SRodney W. Grimes.Pp 549b50d902SRodney W. GrimesThe options are as follows: 55884bd44cSPhilippe Charnier.Bl -tag -width indent 56*b2b8fa1aSNathan Huff.It Fl -libxo 57*b2b8fa1aSNathan HuffGenerate output via 58*b2b8fa1aSNathan Huff.Xr libxo 3 59*b2b8fa1aSNathan Huffin a selection of different human and machine readable formats. 60*b2b8fa1aSNathan HuffSee 61*b2b8fa1aSNathan Huff.Xr xo_parse_args 3 62*b2b8fa1aSNathan Hufffor details on command line arguments. 63fd543f27SMax Laier.It Fl A 64fd543f27SMax LaierDisplay the apparent size instead of the disk usage. 65fd543f27SMax LaierThis can be helpful when operating on compressed volumes or sparse files. 66fd543f27SMax Laier.It Fl B Ar blocksize 67fd543f27SMax LaierCalculate block counts in 68fd543f27SMax Laier.Ar blocksize 69fd543f27SMax Laierbyte blocks. 70fd543f27SMax LaierThis is different from the 71476c601bSKyle Evans.Fl h , k , m , 72476c601bSKyle Evans.Fl Fl si 73653fa521SGlen Barberand 7469739e8dSDag-Erling Smørgrav.Fl g 75fd543f27SMax Laieroptions or setting 76fd543f27SMax Laier.Ev BLOCKSIZE 77f6ac2391SJoel Dahland gives an estimate of how much space the examined file hierarchy would 78fd543f27SMax Laierrequire on a filesystem with the given 79fd543f27SMax Laier.Ar blocksize . 80fd543f27SMax LaierUnless in 81fd543f27SMax Laier.Fl A 82fd543f27SMax Laiermode, 83fd543f27SMax Laier.Ar blocksize 84fd543f27SMax Laieris rounded up to the next multiple of 512. 851aa8a0a9SJordan K. Hubbard.It Fl H 861aa8a0a9SJordan K. HubbardSymbolic links on the command line are followed, symbolic links in file 871aa8a0a9SJordan K. Hubbardhierarchies are not followed. 884bb69e35SPeter Pentchev.It Fl I Ar mask 894bb69e35SPeter PentchevIgnore files and directories matching the specified 904bb69e35SPeter Pentchev.Ar mask . 91653fa521SGlen Barber.It Fl L 92653fa521SGlen BarberSymbolic links on the command line and in file hierarchies are followed. 9395a09b05SRuslan Ermilov.It Fl P 9495a09b05SRuslan ErmilovNo symbolic links are followed. 9595a09b05SRuslan ErmilovThis is the default. 969b50d902SRodney W. Grimes.It Fl a 971aa8a0a9SJordan K. HubbardDisplay an entry for each file in a file hierarchy. 98653fa521SGlen Barber.It Fl c 99653fa521SGlen BarberDisplay a grand total. 100653fa521SGlen Barber.It Fl d Ar depth 101653fa521SGlen BarberDisplay an entry for all files and directories 102653fa521SGlen Barber.Ar depth 103653fa521SGlen Barberdirectories deep. 10469739e8dSDag-Erling Smørgrav.It Fl g 10569739e8dSDag-Erling SmørgravDisplay block counts in 1073741824-byte (1 GiB) blocks. 10654aa1771SMichael Haro.It Fl h 107653fa521SGlen Barber.Dq Human-readable 108653fa521SGlen Barberoutput. 1096a3e8b0aSRuslan ErmilovUse unit suffixes: Byte, Kilobyte, Megabyte, 110476c601bSKyle EvansGigabyte, Terabyte and Petabyte based on powers of 1024. 111653fa521SGlen Barber.It Fl k 11269739e8dSDag-Erling SmørgravDisplay block counts in 1024-byte (1 kiB) blocks. 113653fa521SGlen Barber.It Fl l 114653fa521SGlen BarberIf a file has multiple hard links, count its size multiple times. 115653fa521SGlen BarberThe default behavior of 116653fa521SGlen Barber.Nm 117653fa521SGlen Barberis to count files with multiple hard links only once. 118653fa521SGlen BarberWhen the 119653fa521SGlen Barber.Fl l 120653fa521SGlen Barberoption is specified, the hard link checks are disabled, and these files 121653fa521SGlen Barberare counted (and displayed) as many times as they are found. 122653fa521SGlen Barber.It Fl m 12369739e8dSDag-Erling SmørgravDisplay block counts in 1048576-byte (1 MiB) blocks. 124653fa521SGlen Barber.It Fl n 125653fa521SGlen BarberIgnore files and directories with user 126653fa521SGlen Barber.Dq nodump 127653fa521SGlen Barberflag 128653fa521SGlen Barber.Pq Dv UF_NODUMP 129653fa521SGlen Barberset. 13054aa1771SMichael Haro.It Fl r 13154aa1771SMichael HaroGenerate messages about directories that cannot be read, files 1326a3e8b0aSRuslan Ermilovthat cannot be opened, and so on. 1336a3e8b0aSRuslan ErmilovThis is the default case. 13454aa1771SMichael HaroThis option exists solely for conformance with 13554aa1771SMichael Haro.St -xpg4 . 1361aa8a0a9SJordan K. Hubbard.It Fl s 1374e86fcacSSheldon HearnDisplay an entry for each specified file. 1384e86fcacSSheldon Hearn(Equivalent to 13994ba280cSRuslan Ermilov.Fl d Li 0 ) 140476c601bSKyle Evans.It Fl Fl si 141476c601bSKyle Evans.Dq Human-readable 142476c601bSKyle Evansoutput. 143476c601bSKyle EvansUse unit suffixes: Byte, Kilobyte, Megabyte, 144476c601bSKyle EvansGigabyte, Terabyte and Petabyte based on powers of 1000. 145f0cc075cSBrian Somers.It Fl t Ar threshold 146f0cc075cSBrian SomersDisplay only entries for which size exceeds 147f0cc075cSBrian Somers.Ar threshold . 148f0cc075cSBrian SomersIf 149f0cc075cSBrian Somers.Ar threshold 150f0cc075cSBrian Somersis negative, display only entries for which size is less than the absolute 151f0cc075cSBrian Somersvalue of 152f0cc075cSBrian Somers.Ar threshold . 1539b50d902SRodney W. Grimes.It Fl x 1549b50d902SRodney W. GrimesFile system mount points are not traversed. 1559b50d902SRodney W. Grimes.El 1569b50d902SRodney W. Grimes.Pp 1573898680cSPhilippe CharnierThe 1583898680cSPhilippe Charnier.Nm 1593898680cSPhilippe Charnierutility counts the storage used by symbolic links and not the files they 1609b50d902SRodney W. Grimesreference unless the 1619b50d902SRodney W. Grimes.Fl H 1629b50d902SRodney W. Grimesor 1639b50d902SRodney W. Grimes.Fl L 1649b50d902SRodney W. Grimesoption is specified. 1659b50d902SRodney W. GrimesIf either the 1669b50d902SRodney W. Grimes.Fl H 1679b50d902SRodney W. Grimesor 1689b50d902SRodney W. Grimes.Fl L 169653fa521SGlen Barberoption is specified, storage used by any symbolic links which are 170653fa521SGlen Barberfollowed is not counted (or displayed). 1716530d2f2SJilles TjoelkerThe 1726530d2f2SJilles Tjoelker.Fl H , 1736530d2f2SJilles Tjoelker.Fl L 1746530d2f2SJilles Tjoelkerand 1756530d2f2SJilles Tjoelker.Fl P 1766530d2f2SJilles Tjoelkeroptions override each other and the command's actions are determined 1776530d2f2SJilles Tjoelkerby the last one specified. 178653fa521SGlen Barber.Pp 179653fa521SGlen BarberThe 180476c601bSKyle Evans.Fl h , k , m 181653fa521SGlen Barberand 182476c601bSKyle Evans.Fl Fl si 183653fa521SGlen Barberoptions all override each other; the last one specified determines 184653fa521SGlen Barberthe block counts used. 18584717b42SPoul-Henning Kamp.Sh ENVIRONMENT 1869b50d902SRodney W. Grimes.Bl -tag -width BLOCKSIZE 1879b50d902SRodney W. Grimes.It Ev BLOCKSIZE 1881aa67f69SPhilippe CharnierIf the environment variable 1899b50d902SRodney W. Grimes.Ev BLOCKSIZE 1901aa67f69SPhilippe Charnieris set, and the 191476c601bSKyle Evans.Fl h , k , m 192fd543f27SMax Laieror 193476c601bSKyle Evans.Fl Fl si 194fd543f27SMax Laieroptions are not specified, the block counts will be displayed in units of 195fd543f27SMax Laierthat block size. 19687faa07bSSheldon HearnIf 1971aa8a0a9SJordan K. Hubbard.Ev BLOCKSIZE 1981aa8a0a9SJordan K. Hubbardis not set, and the 199476c601bSKyle Evans.Fl h , k , m 200fd543f27SMax Laieror 201476c601bSKyle Evans.Fl Fl si 202fd543f27SMax Laieroptions are not specified, the block counts will be displayed in 512-byte 203fd543f27SMax Laierblocks. 2049b50d902SRodney W. Grimes.El 205625dbdefSJoel Dahl.Sh EXAMPLES 206614b56b1SJoel DahlShow disk usage for all files in the current directory. 207614b56b1SJoel DahlOutput is in human-readable form: 208625dbdefSJoel Dahl.Pp 209625dbdefSJoel Dahl.Dl # du -ah 210625dbdefSJoel Dahl.Pp 211625dbdefSJoel DahlSummarize disk usage in the current directory: 212625dbdefSJoel Dahl.Pp 213625dbdefSJoel Dahl.Dl # du -hs 214625dbdefSJoel Dahl.Pp 215625dbdefSJoel DahlSummarize disk usage for a specific directory: 216625dbdefSJoel Dahl.Pp 217625dbdefSJoel Dahl.Dl # du -hs /home 218625dbdefSJoel Dahl.Pp 219614b56b1SJoel DahlShow name and size of all C files in a specific directory. 220614b56b1SJoel DahlAlso display a grand total at the end: 221625dbdefSJoel Dahl.Pp 222625dbdefSJoel Dahl.Dl # du -ch /usr/src/sys/kern/*.c 2239b50d902SRodney W. Grimes.Sh SEE ALSO 2249b50d902SRodney W. Grimes.Xr df 1 , 225fadc7151SMaxim Konovalov.Xr chflags 2 , 2269b50d902SRodney W. Grimes.Xr fts 3 , 227*b2b8fa1aSNathan Huff.Xr libxo 3 , 228*b2b8fa1aSNathan Huff.Xr xo_parse_args 3 , 2299b50d902SRodney W. Grimes.Xr symlink 7 , 230c4b4d743SMike Pritchard.Xr quot 8 231bbb4c4d8SMark Johnston.Sh STANDARDS 232bbb4c4d8SMark JohnstonThe 233884bd44cSPhilippe Charnier.Nm 234bbb4c4d8SMark Johnstonutility is compliant with the 235bbb4c4d8SMark Johnston.St -p1003.1-2008 236bbb4c4d8SMark Johnstonspecification. 237bbb4c4d8SMark Johnston.Pp 238bbb4c4d8SMark JohnstonThe flags 239bbb4c4d8SMark Johnston.Op Fl cdhP , 240bbb4c4d8SMark Johnstonas well as the 241bbb4c4d8SMark Johnston.Ev BLOCKSIZE 242bbb4c4d8SMark Johnstonenvironment variable, 243bbb4c4d8SMark Johnstonare extensions to that specification. 244bbb4c4d8SMark Johnston.Pp 245bbb4c4d8SMark JohnstonThe flag 246bbb4c4d8SMark Johnston.Op Fl r 247bbb4c4d8SMark Johnstonis accepted but ignored, for compatibility with systems implementing 248bbb4c4d8SMark Johnstonthe obsolete 249bbb4c4d8SMark Johnston.St -xcu5 250bbb4c4d8SMark Johnstonstandard. 251bbb4c4d8SMark Johnston.Sh HISTORY 252bbb4c4d8SMark JohnstonThe 253bbb4c4d8SMark Johnston.Nm 254bbb4c4d8SMark Johnstonutility and its 255bbb4c4d8SMark Johnston.Fl a 256bbb4c4d8SMark Johnstonand 257bbb4c4d8SMark Johnston.Fl s 258bbb4c4d8SMark Johnstonoptions first appeared in 259b8923d4cSWolfram Schneider.At v1 . 260bbb4c4d8SMark Johnston.Pp 261bbb4c4d8SMark JohnstonThe 262bbb4c4d8SMark Johnston.Fl r 263bbb4c4d8SMark Johnstonoption first appeared in 264bbb4c4d8SMark Johnston.At III 265bbb4c4d8SMark Johnstonand is available since 266bbb4c4d8SMark Johnston.Fx 3.5 . 267bbb4c4d8SMark JohnstonThe 268bbb4c4d8SMark Johnston.Fl k 269bbb4c4d8SMark Johnstonand 270bbb4c4d8SMark Johnston.Fl x 271bbb4c4d8SMark Johnstonoptions first appeared in 272bbb4c4d8SMark Johnston.Bx 4.3 Reno 273bbb4c4d8SMark Johnstonand 274bbb4c4d8SMark Johnston.Fl H 275bbb4c4d8SMark Johnstonin 276bbb4c4d8SMark Johnston.Bx 4.4 . 277bbb4c4d8SMark JohnstonThe 278bbb4c4d8SMark Johnston.Fl c 279bbb4c4d8SMark Johnstonand 280bbb4c4d8SMark Johnston.Fl L 281bbb4c4d8SMark Johnstonoptions first appeared in the GNU fileutils; 282bbb4c4d8SMark Johnston.Fl L 283bbb4c4d8SMark Johnstonand 284bbb4c4d8SMark Johnston.Fl P 285bbb4c4d8SMark Johnstonare available since 286bbb4c4d8SMark Johnston.Bx 4.4 Lite1 , 287bbb4c4d8SMark Johnston.Fl c 288bbb4c4d8SMark Johnstonsince 289bbb4c4d8SMark Johnston.Fx 2.2.6 . 290bbb4c4d8SMark JohnstonThe 291bbb4c4d8SMark Johnston.Fl d 292bbb4c4d8SMark Johnstonoption first appeared in 293bbb4c4d8SMark Johnston.Fx 2.2 , 294bbb4c4d8SMark Johnston.Fl h 295bbb4c4d8SMark Johnstonfirst appeared in 296bbb4c4d8SMark Johnston.Fx 4.0 . 297bbb4c4d8SMark Johnston.Sh AUTHORS 298bbb4c4d8SMark Johnston.An -nosplit 299bbb4c4d8SMark JohnstonThis version of 300bbb4c4d8SMark Johnston.Nm 301bbb4c4d8SMark Johnstonwas written by 302bbb4c4d8SMark Johnston.An Chris Newcomb 303bbb4c4d8SMark Johnstonfor 304bbb4c4d8SMark Johnston.Bx 4.3 Reno 305bbb4c4d8SMark Johnstonin 1989. 306