parallel (1) Linux Manual Page
parallel – run programs in parallel
Synopsis
- parallel [options] [command]— [argument …]
- parallel [options]— [command …]
Description
parallel If no command is specified before the –, the commands after it are instead run in parallel.
Options
-j maxjobs- Use to limit the number of jobs that are run at the same time.
-l maxload
- Wait as needed to avoid starting new jobs when the system’s load average is not below the specified limit.
-i
- Normally the command is passed the argument at the end of its command line. With this option, any instances of "{}" in the command are replaced with the argument.
-n
- Number of arguments to pass to a command at a time. Default is 1. Incompatible with -i
Example
parallel sh -c "echo hi; sleep 2; echo bye" — 1 2 3This 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.
