parallel - run programs in parallel
parallel [options] [command]-- [argument ...]
parallel [options]-- [command ...]
parallel runs the specified command, passing it a single one of the specified arguments. This is repeated for each argument. Jobs may be run in parallel. The default is to run one job per CPU.
If no command is specified before the --, the commands after it are instead run in parallel.
parallel sh -c "echo hi; sleep 2; echo bye" -- 1 2 3
This runs three subshells that each print a message, delay, and print another message. If your system has multiple CPUs, parallel will run some of the jobs in parallel, which should be clear from the order the messages are output.
parallel -j 3 ufraw -o processed -- *.NEF
This runs three ufraw processes at the same time until all of the NEF files have been processed.
parallel -j 3 -- ls df "echo hi"
This runs three independent commands in parallel.
Its exit status is the combination of the exit statuses of each command ran, ORed together. (Thus, if any one command exits nonzero, parallel as a whole will exit nonzero.)
All output to stdout and stderr is serialised through a corresponding internal pipe, in order to prevent annoying concurrent output behaviour. Note that serialisation is not done on any other file descriptors and file position based access to a nonstandard file descriptor might have unexpected results.
Tollef Fog Heen