• du


    du 功能说明:统计磁盘空间使用情况。
     
    参数选项:
    -a  显示所有文件大小。
    -h  以人类刻度的方式查看,以K、M、G为单位。
    -s  显示文件的大小总和。
    --exclude=<目录或文件>  略过指定的目录或文件。
    -X,--exclude-from=FILE  从文件中读取需要略过的目录或文件。
    --max-depth=N  显示N级子目录的大小,当N=0时,该参数和-s参数的效果一样。
    
    
    显示所有目录或文件所占用空间
    [root@testdb ~]# du -a
    4    ./.bashrc
    4    ./ls.txt
    4    ./.pydistutils.cfg
    4    ./.bash_profile
    4    ./a.log
    20    ./slow.log
    4    ./.tcshrc
    12    ./.bash_history
    4    ./.cshrc
    4    ./.viminfo
    0    ./c.log
    4    ./.cache/abrt/lastnotification
    8    ./.cache/abrt
    12    ./.cache
    4    ./.bash_logout
    4    ./b.log
    4    ./.pip/pip.conf
    8    ./.pip
    4    ./.config/abrt
    8    ./.config
    4    ./my.cnf
    4    ./.pki/nssdb
    8    ./.pki
    0    ./.ssh/authorized_keys
    4    ./.ssh
    120    .
    
    
    参数-s与-h使用案例
    显示当前目录的总大小
    [root@testdb ~]# du -s
    120    .
    
    
    -h参数会转换易读的大小结果
    [root@testdb ~]# du -h
    8.0K    ./.cache/abrt
    12K    ./.cache
    8.0K    ./.pip
    4.0K    ./.config/abrt
    8.0K    ./.config
    4.0K    ./.pki/nssdb
    8.0K    ./.pki
    4.0K    ./.ssh
    120K    .
    
    
    -sh 是常用的命令组合,也是推荐的方法
    [root@testdb ~]# du -sh
    120K    .
    
    
    显示指定目录的总大小
    [root@testdb ~]# du -sh /usr/local
    458M    /usr/local
    
    
    显示指定层次的目录的大小
    [root@testdb ~]# du -h --max-depth=1 /usr/local
    4.0K    /usr/local/lib
    4.0K    /usr/local/games
    4.0K    /usr/local/src
    4.0K    /usr/local/libexec
    116K    /usr/local/bin
    4.0K    /usr/local/etc
    458M    /usr/local/qcloud
    112K    /usr/local/share
    4.0K    /usr/local/include
    4.0K    /usr/local/sbin
    4.0K    /usr/local/lib64
    458M    /usr/local
    [root@testdb ~]# 
    [root@testdb ~]# du -h --max-depth=2 /usr/local
    4.0K    /usr/local/lib
    4.0K    /usr/local/games
    4.0K    /usr/local/src
    4.0K    /usr/local/libexec
    116K    /usr/local/bin
    4.0K    /usr/local/etc
    8.0K    /usr/local/qcloud/gpu
    12K    /usr/local/qcloud/nv
    182M    /usr/local/qcloud/monitor
    4.9M    /usr/local/qcloud/drivers
    8.0K    /usr/local/qcloud/udev_run
    36K    /usr/local/qcloud/irq
    8.0K    /usr/local/qcloud/rps
    12M    /usr/local/qcloud/stargate
    260M    /usr/local/qcloud/YunJing
    16K    /usr/local/qcloud/action
    458M    /usr/local/qcloud
    4.0K    /usr/local/share/applications
    4.0K    /usr/local/share/info
    80K    /usr/local/share/man
    20K    /usr/local/share/locale
    112K    /usr/local/share
    4.0K    /usr/local/include
    4.0K    /usr/local/sbin
    4.0K    /usr/local/lib64
    458M    /usr/local
    
     
    排除指定的目录
    [root@testdb ~]# du -h --max-depth=2 /usr/local --exclude=/usr/local/share 
    4.0K    /usr/local/lib
    4.0K    /usr/local/games
    4.0K    /usr/local/src
    4.0K    /usr/local/libexec
    116K    /usr/local/bin
    4.0K    /usr/local/etc
    8.0K    /usr/local/qcloud/gpu
    12K    /usr/local/qcloud/nv
    182M    /usr/local/qcloud/monitor
    4.9M    /usr/local/qcloud/drivers
    8.0K    /usr/local/qcloud/udev_run
    36K    /usr/local/qcloud/irq
    8.0K    /usr/local/qcloud/rps
    12M    /usr/local/qcloud/stargate
    260M    /usr/local/qcloud/YunJing
    16K    /usr/local/qcloud/action
    458M    /usr/local/qcloud
    4.0K    /usr/local/include
    4.0K    /usr/local/sbin
    4.0K    /usr/local/lib64
    458M    /usr/local



  • 相关阅读:
    C++重载运算符
    C++中的友元函数和友元类
    C++中的static关键字
    C++的new运算符和delete运算符
    git常用命令
    php+mysql+apache报错
    Nodejs 异步式 I/O 与事件式编程
    开始用Node.js编程
    Nodejs 模块
    Mac OS X上安装Node.js
  • 原文地址:https://www.cnblogs.com/l10n/p/9416673.html
Copyright © 2020-2023  润新知