Du (Unix)
From Wikipedia, the free encyclopedia
- The correct title of this article is du. The initial letter is shown capitalized due to technical restrictions.
du
(abbreviated from disk usage) is a standard Unix program used to estimate the file space usage; space used under a particular directory or files on a file system.
Contents |
[edit] History
The du
utility first appeared in version 1 of AT&T UNIX.
[edit] Specification
By default, the Single Unix Specification (SUS) specifies that du
is to display the file space allocated to each file and directory contained in the current directory. Links will be displayed as the size of the link file, not what is being linked to; the size of the content of directories is displayed, as expected.
As du
reports allocation space and not absolute file space, the amount of space on a file system shown by du
may vary from that shown by df
if files have been deleted but their blocks not yet freed.
[edit] Usage
du
takes a single argument, specifying a pathname for du to work; if it is not specified, the current directory is used. The SUS mandates for du the following options:
- -a, display an entry for each file (and not directory) contained in the current directory
- -H, calculate disk usage for link references specified on the command line
- -k, show sizes as multiples of 1024 bytes, not 512-byte
- -L, calculate disk usage for link references anywhere
- -s, report only the sum of the usage in the current directory, not for each file
- -x, only traverse files and directories on the device on which the pathname argument is specified.
Other Unix and Unix-like operating systems may add extra options. For example, BSD and GNU du
specify a -h option, displaying disk usage in a format easier to read by the user, adding units with the appropriate SI prefix (eg 10MB). GNU du
however conflicts with the SUS specification by using the short -H option to display binary prefixes instead.
[edit] Example (sum of directories in Kbytes)
$ du -sk * 2800344 directoryOne 4270554 directoryTwo
[edit] See also
[edit] External links
- du -- specification from the Single Unix Specification
[edit] Manual pages
[edit] Other
- Disk space-related utilities at Freshmeat.net
Unix command line programs (more) | |||
File and file system management: | cat | cd | chmod | chown | chgrp | cp | du | df | file | fsck | ln | ls | lsof | mkdir | more | mount | mv | pwd | rm | rmdir | split | touch | tree | ||
Process management: | anacron | at | chroot | crontab | kill | killall | nice | pgrep | pidof | pkill | ps | sleep | screen | time | timex | top | wait | ||
User Management/Environment: | env | finger | id | locale | mesg | passwd | su | sudo | uname | uptime | w | wall | who | whoami | write | ||
Text processing: | awk | cut | diff | ex | head | iconv | join | less | more | nkf | paste | sed | sort | tail | tr | uniq | wc | xargs | ||
Shell programming: | echo | expr | printf | unset | Printing: | lp |
Communications: inetd | netstat | ping | rlogin | traceroute |
Searching: find | grep | strings |
Miscellaneous: banner | bc | cal | man | size | yes |