小白使用linux快速查看当前目录大小的技巧

linux下我们经常想要知道一个目录的大小,没有windows那么直观可以右键查看

不过linux有它便利的地方

 

查看当前目录大小

du -h --max-depth=1 ./

root@fff:~# du -h –max-depth=1 ./
3.9M ./.cache
1.4M ./.acme.sh
129M ./aws
20K ./.bypy
12K ./.aws
134M ./

 

查看指定目录大小

du -h --max-depth=1 /home/SAR

改变“–max-depth=1”中的数值大小就可以指定查看该目录下多少级子目录

root@fff:~# du -h –max-depth=1 /home/SAR
16K /home/SAR/lost+found
338G /home/SAR

还有另外一条查文件目录大小的命令

du -hs /home/SAR

root@fff:~# du -hs /home/SAR
338G /home/SAR

阅读剩余
THE END