List files over a specific size in current directory and all subdirectories

后端 未结 5 1810
迷失自我
迷失自我 2020-12-22 21:04

How can I display all files greater than 10k bytes in my current directory and it\'s subdirectories.

Tried ls -size +10k but that didn\'t work.

5条回答
  •  离开以前
    2020-12-22 21:52

    You may use ls like that:

    ls -lR | egrep -v '^d' | awk '$5>10240{print}'
    

    Explanation:

    ls -lR         # list recursivly
    egrep -v '^d'  # only print lines which do not start with a 'd'. (files)
    

    only print lines where the fifth column (size) is greater that 10240 bytes:

    awk '$5>10240{print}'
    

提交回复
热议问题