parallel xargs
April 26, 2018
To run a script in parallel using xargs
:
printf %d\\n {0..9} | xargs -n 1 -P8 sleep
In this case sleep is going to be call 8 times (-P8)
using has the input an
int from 0 to 9.
From the man:
-P maxprocs
Parallel mode: run at most maxprocs invocations of utility at once.