1du(1) User Commands du(1)
2
3
4
6 du - summarize disk usage
7
9 /usr/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L]
10 [file ...]
11
12
13 /usr/xpg4/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L]
14 [file ...]
15
16
18 The du utility writes to standard output the size of the file space
19 allocated to, and the size of the file space allocated to each subdi‐
20 rectory of, the file hierarchy rooted in each of the specified files.
21 The size of the file space allocated to a file of type directory is
22 defined as the sum total of space allocated to all files in the file
23 hierarchy rooted in the directory plus the space allocated to the
24 directory itself. This sum will include the space allocated to any
25 extended attributes encountered.
26
27
28 Files with multiple links will be counted and written for only one
29 entry. The directory entry that is selected in the report is unspeci‐
30 fied. By default, file sizes are written in 512-byte units, rounded up
31 to the next 512-byte unit.
32
33 /usr/xpg4/bin/du
34 When du cannot obtain file attributes or read directories (see
35 stat(2)), it will report an error condition and the final exit status
36 will be affected.
37
39 The following options are supported for /usr/bin/du and
40 /usr/xpg4/bin/du:
41
42 -a In addition to the default output, report the size of each file
43 not of type directory in the file hierarchy rooted in the speci‐
44 fied file. Regardless of the presence of the -a option, non-
45 directories given as file operands will always be listed.
46
47
48 -d Do not cross filesystem boundaries. For example, the command, du
49 -d / reports usage only on the root partition.
50
51
52 -h All sizes are scaled to a human readable format, for example,
53 14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively divid‐
54 ing by 1024.
55
56
57 -H If a symbolic link to a directory is specified on the command
58 line, process the symbolic link by using the directory which the
59 symbolic link references, rather than the link itself.
60
61
62 -k Write the files sizes in units of 1024 bytes, rather than the
63 default 512-byte units.
64
65
66 -L Process symbolic links by using the file or directory which the
67 symbolic link references, rather than the link itself.
68
69
70 -m Write the files sizes in units of megabytes, rather than the
71 default 512-byte units.
72
73
74 -o Do not add child directories' usage to a parent's total. Without
75 this option, the usage listed for a particular directory is the
76 space taken by the files in that directory, as well as the files
77 in all directories beneath it. This option does nothing if -s is
78 used.
79
80
81 -r Generate diagnostic messages about unreadable directories and
82 files whose status cannot be obtained. /usr/bin/du is silent if
83 these conditions arise and -r is not specified. /usr/xpg4/bin/du
84 acts as though -r is always specified.
85
86
87 -s Instead of the default output, report only the total sum for each
88 of the specified files.
89
90
91 -x When evaluating file sizes, evaluate only those files that have
92 the same device as the file specified by the file operand.
93
94
95
96 Specifying more than one of the options in the mutually exclusive pair,
97 -H and -L, is not considered an error. The last option specified deter‐
98 mines the output format.
99
100
101 Specifying more than one of the options in the mutually exclusive set
102 of options -h, -k, and -m is not considered an error. The last option
103 specified determines the output format.
104
106 The following operand is supported:
107
108 file The path name of a file whose size is to be written. If no file
109 is specified, the current directory is used.
110
111
113 The output from du consists of the amount of the space allocated to a
114 file and the name of the file.
115
117 See largefile(5) for the description of the behavior of du when encoun‐
118 tering files greater than or equal to 2 Gbyte ( 2^31 bytes).
119
121 See environ(5) for descriptions of the following environment variables
122 that affect the execution of du: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
123 and NLSPATH.
124
126 The following exit values are returned:
127
128 0 Successful completion.
129
130
131 >0 An error occurred.
132
133
135 See attributes(5) for descriptions of the following attributes:
136
137 /usr/bin/du
138 ┌─────────────────────────────┬─────────────────────────────┐
139 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
140 ├─────────────────────────────┼─────────────────────────────┤
141 │Availability │SUNWcsu │
142 ├─────────────────────────────┼─────────────────────────────┤
143 │CSI │Enabled │
144 ├─────────────────────────────┼─────────────────────────────┤
145 │Interface Stability │Stable │
146 └─────────────────────────────┴─────────────────────────────┘
147
148 /usr/xpg4/bin/du
149 ┌─────────────────────────────┬─────────────────────────────┐
150 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
151 ├─────────────────────────────┼─────────────────────────────┤
152 │Availability │SUNWxcu4 │
153 ├─────────────────────────────┼─────────────────────────────┤
154 │CSI │Enabled │
155 ├─────────────────────────────┼─────────────────────────────┤
156 │Interface Stability │Standard │
157 └─────────────────────────────┴─────────────────────────────┘
158
160 ls(1), stat(2), attributes(5), environ(5), fsattr(5), largefile(5),
161 standards(5)
162
163
164 System Administration Guide: Basic Administration
165
167 A file with two or more links is counted only once. If, however, there
168 are links between files in different directories where the directories
169 are on separate branches of the file system hierarchy, du will count
170 the excess files more than once.
171
172
173 Files containing holes will result in an incorrect block count.
174
175
176
177SunOS 5.11 6 Feb 2007 du(1)