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的目录。假设,我想找到只有大小超过1000MB的所有目录,在/ home下只有1个maxdepth,如何找到它?
1 个解决方案
#1
50
If I'm interpreting your question right, I think this might be what you want:
如果我正确地解释你的问题,我认为这可能是你想要的:
cd /home
du -sm * | awk '$1 > 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而不是...
#1
50
If I'm interpreting your question right, I think this might be what you want:
如果我正确地解释你的问题,我认为这可能是你想要的:
cd /home
du -sm * | awk '$1 > 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而不是...