一、Linux查看系统中目录磁盘占用
1.du -h
命令
可以查看当前目录各个目录的的磁盘使用情况
~$ du -h
.
..
860K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/MacOS
12K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/zh-Hans.lproj
12K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/English.lproj
16K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/German.lproj
8.0K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/Base.lproj
16K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/Spanish.lproj
16K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/French.lproj
12K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/Japanese.lproj
16K ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources/Italian.lproj
1.0M ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents/Resources
1.9M ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app/Contents
1.9M ./vmware/Windows10x64.vmwarevm/Applications/VMware Unity — Windows10x64.app
97M ./vmware/Windows10x64.vmwarevm/Applications
108K ./vmware/Windows10x64.vmwarevm/caches/screenshots
108K ./vmware/Windows10x64.vmwarevm/caches
19G ./vmware/Windows10x64.vmwarevm
20G ./vmware
60G .
~$
2.awk
命令
使用
awk
过滤出以G为单位的目录
awk '{if($1~/G/){print}}'
过滤第一列包含G的数据
~$ du -h | awk '{if($1~/G/){print}}'
.
..
1.4G ./Library/Containers/com.tencent.WeWorkMac/Data/Library/Application Support
1.4G ./Library/Containers/com.tencent.WeWorkMac/Data/Library
1.4G ./Library/Containers/com.tencent.WeWorkMac/Data
1.4G ./Library/Containers/com.tencent.WeWorkMac
20G ./Library/Containers/com.docker.docker/Data/vms/0
20G ./Library/Containers/com.docker.docker/Data/vms
20G ./Library/Containers/com.docker.docker/Data
20G ./Library/Containers/com.docker.docker
27G ./Library/Containers
1.1G ./Library/Caches/IntelliJIdea2019.1
1.6G ./Library/Caches
30G ./Library
1.7G ./Public/D750/zhoukai
20G ./Public/D750/5.4backup/100ND750
20G ./Public/D750/5.4backup
22G ./Public/D750
23G ./Public
1.3G ./.m2/repository
1.3G ./.m2
23G ./vmware/Windows10x64.vmwarevm
24G ./vmware
97G .
~$
命令:du -h | awk '{if($1~/G/){print}}'
网友评论