Linux 中 du -ch 命令统计指定层级的磁盘大小

 

001、

[root@PC1 test]# ls
test
[root@PC1 test]# tree -h
.
└── [   32]  test
    ├── [  86M]  a.txt
    └── [   43]  dir01
        ├── [ 7.6M]  a.txt
        ├── [ 7.6M]  b.txt
        └── [   19]  xxx
            └── [ 6.6M]  c.txt

3 directories, 4 files
[root@PC1 test]# du -ch --max-depth=0 test/
108M    test/
108M    total
[root@PC1 test]# du -ch --max-depth=1 test/
22M     test/dir01
108M    test/
108M    total
[root@PC1 test]# du -ch --max-depth=2 test/
6.6M    test/dir01/xxx
22M     test/dir01
108M    test/
108M    total

 

 。

 

posted @ 2025-05-15 09:24  小鲨鱼2018  阅读(19)  评论(0)    收藏  举报