Skip navigation

xargs有个开关-P,意思是同时启动多少个子进程。借助xargs的这个特性可以加速grep文件的速度。例如,

grep  -r "libm.so.2" *

可以改写为

find . -type f | xargs -n 1 -P 20 grep "libm.so.2"

这样就会有20个进程同时查找了。

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>