Linux获取文件夹及其子文件夹的大小到一定深度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14720309/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linux get the size of a folder and its subfolders to a certain depth
提问by user1984646
In Linux, I have the following folder structure, I want to get the size of the folder and its subfolders to a certain depth.
在 Linux 中,我有以下文件夹结构,我想获得一定深度的文件夹及其子文件夹的大小。
I have this structure:
我有这个结构:
/AAAA/BBBB/1111
/AAAA/BBBB/2222
/AAAA/BBBB
/AAAA/CCCC
/AAAA/DDDD/3333
/AAAA/DDDD
/AAAA
du -m
, shows me the entire tree, not just 2 levels as I need. What is the proper command?
du -m
, 向我展示了整个树,而不仅仅是我需要的 2 个级别。什么是正确的命令?
采纳答案by Xymostech
You want the -d
or --max-depth
option.
你想要-d
or--max-depth
选项。
du -d 2
回答by X Tian
Limit the depth of search --max-depth=N
.
限制搜索深度--max-depth=N
。