Pexec


pexec is a command-line utility for Linux and other Unix-like operating systems which allows the user to execute shell commands in parallel. The specified code can be executed either locally or on remote hosts, in which case ssh is used to build a secure tunnel between them. Similar to shell loops, a variable is changed as the loop starting the tasks iterates, so that many values can get passed to the specified command or script. pexec is a free software utility, and part of the GNU Project. It is available under the terms of GPLv3, and is part of the current Debian stable release.

Usage

The most common usage is to replace the shell loop, for example:

for x in alpha bravo charlie delta ; do
do_something $x
done

to the form of:

pexec -r alpha bravo charlie delta -e x -o - -c \
'do_something $x'

where the set with the 4 elements of "alpha" "bravo" "charlie" and "delta" define the possible values for the
variable $x. The program pexec features also
Such optional features can be requested using command-line arguments. By default, pexec tries to detect the number of CPUs and uses all of them.