Doing parallel processing in bash?

后端 未结 3 1929
清歌不尽
清歌不尽 2020-12-13 07:24

I\'ve thousands of png files which I like to make smaller with pngcrush. I\'ve a simple find .. -exec job, but it\'s sequential. My machine has qui

3条回答
  •  忘掉有多难
    2020-12-13 07:45

    With GNU Parallel http://www.gnu.org/software/parallel/ it can be done like:

    find /path -print0 | parallel -0 pngcrush {} {.}.temp '&&' mv {.}.temp {} 
    

    Learn more:

    • Watch the intro video for a quick introduction: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1
    • Walk through the tutorial (man parallel_tutorial). You command line will love you for it.

提交回复
热议问题