OpenBSD manual page server

Manual Page Search Parameters

DU(1) General Commands Manual DU(1)

dudisplay disk usage statistics

du [-H | -L | -P] [-a | -d depth | -s] [-cghikmnrx] [file ...]

The du utility displays the file system usage for each file argument and for each directory in the file hierarchy rooted in each directory argument. If no file is specified, the block usage of the hierarchy rooted in the current directory is displayed.

The options are as follows:

Symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not followed.)
All symbolic links are followed.
No symbolic links are followed.
Display an entry for each file in the file hierarchy.
Display the grand total after all the arguments have been processed.
Display an entry files and directories depth directories deep.
If the -g flag is specified, the number displayed is the number of gigabyte (1024*1024*1024 bytes) blocks.
If the -h flag is specified, the numbers will be displayed in "human-readable" format. Use unit suffixes: B (Byte), K (Kilobyte), M (Megabyte), G (Gigabyte), T (Terabyte) and P (Petabyte).
Output inode usage instead of blocks. All "human-readable" options are ignored.
By default, du displays the number of blocks as returned by the stat(2) system call, i.e. 512-byte blocks. If the -k flag is specified, the number displayed is the number of kilobyte (1024 bytes) blocks. Partial numbers of blocks are rounded up.
If the -m flag is specified, the number displayed is the number of megabyte (1024*1024 bytes) blocks.
Ignore files and directories with user "nodump" flag (UF_NODUMP) set.
Generate warning messages about directories that cannot be read. This is the default behaviour.
Display only the grand total for the specified files.
Filesystem mount points are not traversed.

du counts the storage used by symbolic links and not the files they reference unless the -H or -L option is specified. If either the -H or -L options are specified, storage used by any symbolic links which are followed is not counted or displayed. The -H, -L and -P options override each other and the command's actions are determined by the last one specified.

Files having multiple hard links are counted (and displayed) a single time per du execution.

If the environment variable BLOCKSIZE is set, and the -g, -h, -k, and -m options are not specified, the block counts will be displayed in units of that size block.

The du utility exits 0 on success, and >0 if an error occurs.

df(1), chflags(2), fts(3), getbsize(3), symlink(7), quot(8)

A du command appeared in Version 6 AT&T UNIX.

May 14, 2012 NetBSD-7.0.1