Linux 查看统计目录大小

使用命令

查看当前目录大小:du -h 
查看指定目录大小:du -h --max-depth=1 path/dir_name

Usage: du [OPTION]… [FILE]…
or: du [OPTION]… --files0-from=F
Summarize disk usage of each FILE, recursively for directories.
常用参数:
-a 为每个指定文件显示磁盘使用情况,或者为目录中每个文件显示各自磁盘使用情况。
-b显示目录或文件大小时,以byte为单位。
-c 除了显示目录或文件的大小外,同时也显示所有目录或文件的总和。
-D 显示指定符号连接的源文件大小。
-h以K,M,G为单位,提高信息的可读性。
-H或–si 与-h参数相同,但是K,M,G是以1000为换算单位,而不是以1024为换算单位。
-k 以1024 bytes为单位。
-l 重复计算硬件连接的文件。
-L<符号连接>或–dereference<符号连接> 显示选项中所指定符号连接的源文件大小。
-m以1MB为单位。
-s或–summarize 仅显示总计,即当前目录的大小。
-S显示每个目录的大小时,并不含其子目录的大小。
-x以一开始处理时的文件系统为准,若遇上其它不同的文件系统目录则略过。
-X<文件>或–exclude-from=<文件> 在<文件>指定目录或文件。
–exclude=<目录或文件> 略过指定的目录或文件。
–max-depth=<目录层数> 超过指定层数的目录后,予以忽略。
–help 显示帮助。
–version 显示版本信息。

Mandatory arguments to long options are mandatory for short options too.
-0, --null end each output line with 0 byte rather than newline
-a, --all write counts for all files, not just directories
–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
-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’
-c, --total produce a grand total
-D, --dereference-args dereference only symlinks that are listed on the
command line
-d, --max-depth=N 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
–files0-from=F summarize disk usage of the NUL-terminated file
names specified in file F;
If F is - then read names from standard input
-H equivalent to --dereference-args (-D)
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-k like --block-size=1K
-L, --dereference dereference all symbolic links
-l, --count-links count sizes many times if hard linked
-m like --block-size=1M
-P, --no-dereference don’t follow any symbolic links (this is the default)
-S, --separate-dirs do not include size of subdirectories
–si like -h, but use powers of 1000 not 1024
-s, --summarize display only a total for each argument
-t, --threshold=SIZE exclude entries smaller than SIZE if positive,
or entries greater than SIZE if negative
–time show time of the last modification of any file in the
directory, 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’
-X, --exclude-from=FILE exclude files that match any pattern in FILE
–exclude=PATTERN exclude files that match PATTERN
-x, --one-file-system skip directories on different file systems
–help display this help and exit
–version output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 1010241024). Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, … (powers of 1000)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值