
df可以查看一级文件夹大小、使用比例、档案系统及其挂入点,但对文件却无能为力。
du可以查看文件及文件夹的大小。
参数 -h 表示使用「Human-readable」的输出,也就是在档案系统大小使用 GB、MB 等易读的格式。
查看linux文件目录的大小和文件夹包含的文件数
统计总数大小
du -sh xmldb/
du -sm * | sort -n //统计当前目录大小 并安大小 排序
du -sk * | sort -n
du -sk * | grep guojf //看一个人的大小
du -m | cut -d "/" -f 2 //看第二个/ 字符前的文字
查看此文件夹有多少文件 /*/*/* 有多少文件
du xmldb/
du xmldb/*/*/* |wc -l
40752
解释:
wc [-lmw]
参数说明:
-l :多少行
-m:多少字符
-w:多少字
Linux:ls以K、M、G为单位查看文件大小
#man ls
……
-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
……
# ls
cuss.war nohup.out
# ls -l
total 30372
-rw-r--r-- 1 root root 31051909 May 24 10:07 cuss.war
-rw------- 1 root root 0 Mar 20 13:52 nohup.out
# ls -lh
total 30M
-rw-r--r-- 1 root root 30M May 24 10:07 cuss.war
-rw------- 1 root root 0 Mar 20 13:52 nohup.out
# ll -h
total 30M
-rw-r--r-- 1 root root 30M May 24 10:07 cuss.war
-rw------- 1 root root 0 Mar 20 13:52 nohup.out
============ 欢迎各位老板打赏~ ===========


与本文相关的文章
- · 单台服务器应用不中断服务热部署滚动更新方案
- · docker安装code-server
- · centos8安装源
- · SSL 证书免费,自动续期的web服务器Caddy
- · centos安装node18
- · nginx日志按天分割
- · 解决Linux实例磁盘空间满问题
- · centos yum安装Python3.8(史上最简单)
- · linux查看端口占用 netstat -tln|grep 8080
- · 解决jenkins git@github.com: Permission denied (publickey)
- · centos安装chrome+chromedriver
- · 修改FRP默认的http404页面后自行编译