du - 汇总磁盘使用情况
/usr/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L] [--scale[=item1,item2,...]] [file ...]
/usr/xpg4/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L] [--scale[=item1,item2,...]] [file ...]
du 实用程序向标准输出写入分配给以每个指定文件为根的文件分层结构及其每个子目录的文件空间大小。分配给目录类型的文件的文件空间大小定义为分配给以该目录为根的文件分层结构中所有文件的空间与分配给该目录本身的空间之和。此和将包括分配给所遇到的任何扩展属性的空间。
具有多个链接的文件只计为和写作一个条目。未指定在报告中选择的目录条目。缺省情况下,文件大小以 512 字节为单位写入,舍入到下一个 512 字节单位。
当 du 无法获取文件属性或读取目录时(请参见 stat(2)),它将报告错误情况并且最终退出状态将受影响。
/usr/bin/du 和 /usr/xpg4/bin/du 支持以下选项:
除了缺省输出之外,还将报告以指定文件为根的文件分层结构中每个非目录类型的文件的大小。无论是否指定了 –a 选项,都始终列出作为 file 操作数指定的非目录。
不跨越文件系统边界。例如,命令 du -d / 仅报告根分区上的使用情况。
所有大小将调整为用户可读的格式。The –h option is equivalent to using the –scale=max,1024 option.
如果在命令行上指定了目录的符号链接,则将使用符号链接引用的目录而非链接本身来处理符号链接。
以 1024 字节为单位而非缺省的 512 字节单位写入文件大小。
使用符号链接引用的文件或目录而非链接本身处理符号链接。
以 MB 为单位而非缺省的 512 字节单位写入文件大小。
不将子目录的使用量加到父目录的总和中。未指定此选项时,为某个特定目录列出的使用量是该目录中的文件以及该目录下的所有目录中的文件占用的空间。如果使用了 –s,则此选项不起作用。
为无法获取其状态的不可读取的目录和文件生成诊断消息。如果出现这些情况并且未指定 –r,则 /usr/bin/du 以无提示模式运行。/usr/xpg4/bin/du 的行为将如同始终指定了 –r。
仅报告每个指定文件的总和,而非生成缺省输出。
所有大小将调整为用户可读的格式,例如 14K、234M、2.7G 或 3.0T。Scaling is done by repetitively dividing by 1024, unless otherwise specified.
–scale specified without arguments enables default scaled output, and is equivalent to –scale=max,1024.
–scale can be specified with the following arguments.
Scaling is done by repetitively dividing by a scale factor of 1024.The use of binary scaling is indicated by the addition of an 'i' modifier to the suffix (Ki, Mi, Gi, ...).
Values are scaled to the largest unit for which the result retains a non-zero integer part.Up to 2 decimal places of fractional output may be shown.
Values are scaled to the smallest unit capable of showing the full value within the allotted space of 5 columns, and displayed without the use of fractional output.
Values are scaled to the smallest unit capable of showing the full value within the allotted space of 8 columns, and displayed without the use of fractional output.
Scaling is done by repetitively dividing by a scale factor of 1000.
Scaling is done by repetitively dividing by a scale factor of 1024.
在计算文件大小时,仅计算与由 file 操作数指定的文件具有相同设备的那些文件。
指定互斥对 –H 和 –L 中的多个选项不会被视为错误。指定的最后一个选项决定了输出格式。
指定选项互斥集 –h、–k 和 –m 中的多个选项不会被视为错误。指定的最后一个选项决定了输出格式。
支持下列操作数:
要写入其大小的文件的路径名。如果未指定 file,则将使用当前目录。
du 的输出包括分配给文件和文件名的空间量。
有关影响 du 执行的以下环境变量的说明,请参见 environ(7):LANG、LC_ALL、LC_CTYPE、LC_MESSAGES 和 NLSPATH。
将返回以下退出值:
成功完成。
出现错误。
有关下列属性的说明,请参见 attributes(7):
|
|
ls(1), stat(2), attributes(7), environ(7), fsattr(7), standards(7)
具有两个或多个链接的文件只计入一次。不过,如果目录位于文件系统分层结构的不同分支中并且在这些不同的目录中存在文件间链接,则 du 会多次计入额外的文件。
包含漏洞的文件将导致不正确的块计数。