Linux中查看各文件夹大小命令
du -h -x --max-depth=1
[root@localhost 70ga]# du -h -x --max-depth=1
47M ./gatherclient
149M ./datarelease
122M ./scheduler
1.5G ./server
1.5G ./agent
52M ./ssm
0 ./datarelease-logs
3.4G .
查看存盘使用情况 df -h
[root@localhost 70ga]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 38G 32G 5.8G 85% /
devtmpfs 4.8G 0 4.8G 0% /dev
tmpfs 4.9G 144K 4.9G 1% /dev/shm
tmpfs 4.9G 18M 4.8G 1% /run
tmpfs 4.9G 0 4.9G 0% /sys/fs/cgroup
/dev/sda1 497M 158M 340M 32% /boot
/dev/mapper/centos-home 19G 19G 20K 100% /home
tmpfs 984M 28K 984M 1% /run/user/0
内存查看 free -h
[root@localhost 70ga]# free -h
total used free shared buff/cache available
Mem: 9.6G 4.1G 188M 16M 5.4G 5.2G
Swap: 3.9G 261M 3.6G
Linux命令手动清除缓存(free会增加)
echo 3 > /proc/sys/vm/drop_caches
列出user目录及其子目录下所有目录和文件的大小 du -ah ssm/
-a表示包括目录和文件
[root@localhost 70ga]# du -ah ssm/
4.0K ssm/ssm/bin/startup.bat
4.0K ssm/ssm/bin/remove-instance.sh
4.0K ssm/ssm/bin/shutdown-allinstance.sh
4.0K ssm/ssm/bin/start-instance.sh
4.0K ssm/ssm/bin/clean-allinstance.sh
4.0K ssm/ssm/bin/clean-instance-agentcontext.sh
4.0K ssm/ssm/bin/clone-instance.sh
4.0K ssm/ssm/bin/clean-instance-pid.sh
列出当前目录中的目录名不包括eos字符串的目录和子目录的大小:
du -h --exclude='*eos*'
[root@localhost config]# du -h --exclude='*xyz*'
36K ./eos
40K ./internal/excel-config
60K ./internal
4.0K ./principal/default
8.0K ./principal
32K ./user
264K .
[root@localhost config]# du -h --exclude='*eos*'
40K ./internal/excel-config
60K ./internal
4.0K ./principal/default
8.0K ./principal
32K ./user
228K .