find directories having size greater than x MB

末鹿安然 提交于 2020-06-22 06:58:12

问题


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 ?


回答1:


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...



来源:https://stackoverflow.com/questions/17599109/find-directories-having-size-greater-than-x-mb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!