zoukankan      html  css  js  c++  java
  • df-V-du

    1. 使用du -sm查看本机主要目录大小
    2. df VS du
    3. df与du的help对比
    	3.1 df与du相同或相似选项
    	3.2 因针对目标不同,df与du差异选项
    

    1. 使用du -sm查看本机主要目录大小

    /… s2 du -sh 备注
    boot 2 120M boot
    etc 4 25M 配置文件
    root 13 13M root
    usr 19 6.3G usr
    var 20 2.2G var
    bin -> usr/bin 1   链接
    lib -> usr/lib 6   链接
    lib64 -> usr/lib 7   链接
    sbin -> usr/bin 15   链接
    home 5 5.7G 用户磁盘
    mnt 9   挂载点
    dev 3 0 内存数据
    proc 11   内存数据
    sys 17 0 内存数据
    run 14 988k 内存数据
    lost+found 8 16k  
    opt 10 4k 附加应用
    repo 12 4k  
    srv 16 12k 服务
    tmp 18 8k 临时目录
    /usr/… du -sm 备注
    bin/ 470 命令
    include/ 318 头文件
    lib/ 3614 库文件
    lib32/ 6  
    lib64 -> lib/    
    local/ 1  
    sbin -> bin/    
    share/ 2103 帮助...
    src/ 1  
    /var/… du -sm 备注
    cache/ 1899 Pkg
    db/ 1  
    empty/ 1  
    games/ 1  
    lib/ 121
    local/ 1  
    lock -> ../run/lock/ 1  
    log/ 170 日志
    mail -> spool/mail/ 1  
    opt/ 1  
    run -> ../run/ 1  
    spool/ 1  
    tmp/ 1  
    .updated 1  

    2. df VS du

    项目 命令 $ df [OPTION]... [FILE]... $ du [OPTION]... [FILE]…
    名称 disk free disk usage
    描述 查看(文件系统)的磁盘空间占用情况 查看(文件和目录)的磁盘使用情况
    针对 文件系统 文件和目录
    系统调用 statfs fstat
    目标 整个分区 递归,累加文件
    文件非常多时,运行速度 不受文件数量影响 会很慢
    当前存在文件占用空间 包含 包含
    已经删除但还没被释放的空间 包含 不包含
    记录自身的 (i节点,磁盘分布图,间接块,超级块)等对大多数用户级程序是不可见的元数据 Meta Data 包含 不包含
    获取 /tmp 文件系统的块数 # df /tmp
    … Used 52 …
    # du -s /tmp
    44/tmp
    小结 会考虑元数据, 并包含已删除还未释放的部分.
    体现当前实际占用情况.
    用户级程序, 只考虑现有文件,
    获得的数值篇小.
    相关相似的命令有 lsblk, blkid, fdisk -l ls, tree

    3. df与du的help对比

    3.1 df与du相同或相似选项

    $ df --help Usage: df [OPTION]... [FILE]...   $ du --help Usage: du [OPTION]... [FILE]…
    or: du [OPTION]... --files0-from=F
      显示有关文件系统或默认情况下所有文件系统的信息。 说明   递归地汇总文件或目录集的磁盘使用情况。
      Mandatory arguments to long options are mandatory for short options too. =   长选项的强制性参数对于短选项也是必需的。
    -a, --all include pseudo, duplicate, inaccessible file systems
    包括伪,重复,不可访问的文件系统
    相似 -a, --all write counts for all files, not just directories
    写所有文件的计数,而不仅仅是目录
    -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, --block-size=SIZE 在打印之前按SIZE缩放尺寸;
    例如,“-BM”以1,048,576字节为单位打印尺寸;请参阅下面的SIZE格式
    -h, --human-readable print sizes in human readable format
    (e.g., 1K 234M 2G)
    = -h, --human-readable 以人类可读的格式打印尺寸
    (例如1K 234M 2G)
    -H, --si like -h, but use powers of 1000 not 1024 = --si 类似于-h,但使用1000的幂而不是1024
    -i, --inodes list inode usage information instead of block usage = --inodes 列出索引节点使用情况信息,而不是块使用情况
    -k like --block-size=1K = -k 像--block-size = 1K
    --help display this help and exit = --help 显示此帮助并退出
    --version output version information and exit = --version 输出版本信息并退出
    Display values are in units of the first available SIZE from --block-size, and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
    Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
    ~ 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).
    The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
    Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).
    Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
    = The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
    Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).
    Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
    GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
    Full documentation <https://www.gnu.org/software/coreutils/df>
    or available locally via: info '(coreutils) df invocation'
    ~ GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
    Full documentation <https://www.gnu.org/software/coreutils/du>
    or available locally via: info '(coreutils) du invocation'
    FIELD_LIST is a comma-separated list of columns to be included. Valid field names are:
    'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page).
       

    3.2 因针对目标不同,df与du差异选项

    $ df --help Usage: df [OPTION]... [FILE]... cn
    -l, --local limit listing to local file systems 将列表限制为本地文件系统
    --sync invoke sync before getting usage info 在获取使用情况信息之前调用同步
    --no-sync do not invoke sync before getting usage info (default) 在获取使用情况信息之前不调用同步(默认)
    --output[=FIELD_LIST] use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted. 使用FIELD_LIST定义的输出格式,如果省略FIELD_LIST,则打印所有字段。
    -P, --portability use the POSIX output format 使用POSIX输出格式
    --total elide all entries insignificant to available space, and produce a grand total 排除所有与可用空间无关紧要的条目,并产生总计
    -T, --print-type print file system type 打印文件系统类型
    -t, --type=TYPE limit listing to file systems of type TYPE 将列表限制为TYPE类型的文件系统
    -x, --exclude-type=TYPE limit listing to file systems not of type TYPE 将列表限制为非TYPE类型的文件系统
    -v (ignored) (忽略)
    $ du --help Usage: du [OPTION]... [FILE]… or: du [OPTION]... --files0-from=F
    -b, --bytes equivalent to '--apparent-size --block-size=1' 等效于'--apparent-size --block-size = 1'
    --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 打印外观大小,而不是磁盘使用情况;尽管表观大小通常较小,但由于(“稀疏”)文件中的漏洞,内部碎片,间接块等,它可能会更大
    -X, --exclude-from=FILE exclude files that match any pattern in FILE 排除与FILE中任何模式匹配的文件
    --exclude=PATTERN exclude files that match PATTERN 排除与PATTERN匹配的文件
    -x, --one-file-system skip directories on different file systems 跳过不同文件系统上的目录
    -0, --null end each output line with NUL, not newline 用NUL而不是换行符结束每个输出行
    -c, --total produce a grand total 产生总计
    -s, --summarize display only a total for each argument 每个参数仅显示总计
    -S, --separate-dirs for directories do not include size of subdirectories 对于目录,不包括子目录的大小
    -D, --dereference-args dereference only symlinks that are listed on the command line 仅取消引用命令行上列出的符号链接
    -L, --dereference dereference all symbolic links 取消引用所有符号链接
    -P, --no-dereference don't follow any symbolic links (this is the default) 不要遵循任何符号链接(这是默认设置)
    -H equivalent to --dereference-args (-D) 等效于--dereference-args(-D)
    -l, --count-links count sizes many times if hard linked 如果硬链接,则多次计算大小
    -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 仅当目录(或文件,带有--all)的级别低于命令行参数N或更少级别时,才显示该目录的总和; --max-depth = 0与--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 总结文件F中指定的NUL终止文件名的磁盘使用情况;如果F为-,则从标准输入中读取名称
    -t, --threshold=SIZE exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative 如果为正则排除小于SIZE的条目,如果为负则排除大于SIZE的条目
    --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 将时间显示为WORD而不是修改时间:atime,access,use,ctime或status
    --time-style=STYLE show times using STYLE, which can be: full-iso, long-iso, iso, or +FORMAT; FORMAT is interpreted like in 'date' 使用STYLE显示时间,可以是:完全等距,长时间等距,iso或+ FORMAT;格式的解释类似于“日期”
     
  • 相关阅读:
    Git知识总览(四) git分支管理之rebase 以及 cherry-pick相关操作
    基于visual Studio2013解决算法导论之002归并排序
    基于visual Studio2013解决算法导论之001插入排序
    android用户界面之ScrollView教程实例汇总
    android ScrollView--Linearlayout可以上下拖动
    在 Windows Azure 网站上使用 Django、Python 和 MySQL:创建博客应用程序
    Windows Azure 网站 (WAWS) 和中间证书
    Windows Azure 社区新闻综述(#78 版)
    通过 HTTPS 和 SSL 确保 Windows Azure 网站 (WAWS) 安全
    盘点:#AzureChat
  • 原文地址:https://www.cnblogs.com/sztom/p/12928242.html
Copyright © 2011-2022 走看看