标签:des cWeb style blog http color java os 使用
du的英文为:disk usage,含义是磁盘空间使用情况,功能是逐级进入指定目录的每一个子目录并显示该目录占用文件系统数据块的情况,如果没有指定目录,则对当前的目录进行统计。
面对对象时目录文件,而不是其他普通文件
NAME
du - estimate file space usage
SYNOPSIS
du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F
DESCRIPTION
Summarize disk usa-- 只显示大小大于SIZE的目录文件
ge of each FILE, recursively for directories.
Mandatory arguments to long options are mandatory for short options too.
(一)显示单位选项:
-B, --block-size=SIZE scale sizes by SIZE before printing them. E.g., ‘-BM‘ prints sizes in units of 1,048,576 bytes. See SIZE format below.(总的用法)
-b, --bytes
equivalent to ‘--apparent-size --block-size=1‘
-k like --block-size=1K
-m like --block-size=1M
-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G) (来个自动选择显示单位,类似与free命令)
--apparent-size
print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due to holes in
(‘sparse‘) files, internal fragmentation, indirect blocks, and the like
-c, --total produce a grand total -- 最后显示总的空间大小
(此处牵扯到一个概念:实际文件大小与disk usage的差别)
(二)范围圈定选项(选出符合特定条件的文件):
I.深度:
-d, --max-depth=N -- 指定统计的文件的深度 (有点类似与find的一个参数)
print the total for a directory (or file, with --all) only if
it is N or fewer levels below the command line argument;
--max-depth=0 is the same as --summarize
II.大小
-t, --threshold=SIZE
exclude entries smaller than SIZE if positive, or entries
greater than SIZE if negative
1 +SIZE (K | M | G ...) 只显示大小大于SIZE的目录文件
2 -SIZE (K | M | G ... ) 只显示大小小于SIZE的目录文件
III.时间
--time show time of the last modification of any file in the direc‐
tory, or any of its subdirectories
--time=WORD
show time as WORD instead of modification time: atime, access,
use, ctime or status
--time-style=STYLE
show times using style STYLE: full-iso, long-iso, iso, +FORMAT
FORMAT is interpreted like ‘date‘
显示时间一览中,指定显示的特定时间是 atime access use ctime or status
严格来说这个选项不是起到范围排除的作用只是一个附加项
IV.exclude
-X, --exclude-from=FILE 这个没看懂
exclude files that match any pattern in FILE
--exclude=PATTERN 任何符合PATTERN的目录均不在显示之列(可以使用通配符来扩展)
exclude files that match PATTERN
-x, --one-file-system
skip directories on different file systems
PATTERNS
PATTERN is a shell pattern (not a regular expression). The pattern ?
matches any one character, whereas * matches any string (composed of
zero, one or multiple characters). For example, *.o will match any
files whose names end in .o. Therefore, the command
du --exclude=‘*.o‘
will skip all files and subdirectories ending in .o (including the
file .o itself).
对于PATTERN可以使用通配符进行匹配(不是正则表达式)这是个很有用的选项。
标签:des cWeb style blog http color java os 使用
原文地址:http://www.cnblogs.com/IceSword-syy/p/3933783.html