Linux 查找大小大于 x MB 的目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17599109/
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
find directories having size greater than x MB
提问by Sandy
Is it possible to find the directories only having size large than x MB. Suppose, I want to find all the directories only whose size is large than 1000MB with only 1 maxdepth under /home, how to find it in ?
是否可以找到大小仅大于 x MB 的目录。假设,我只想在 /home 下找到所有大小大于 1000MB 且只有 1 个 maxdepth 的目录,如何在 .
采纳答案by twalberg
If I'm interpreting your question right, I think this might be what you want:
如果我正确解释您的问题,我认为这可能是您想要的:
cd /home
du -sm * | awk ' > 1000'
This will show all directories in /home
that contain more than 1000MB. If your version of du
doesn't support -m
, you can use du -sk
and adjust the awk
bit to look for more than 1,000,000KB instead...
这将显示/home
包含超过 1000MB 的所有目录。如果您的版本du
不支持-m
,您可以使用du -sk
并调整awk
位来查找超过 1,000,000KB...