TIL

Running commands in parallel with GNU parallel

Ever need to run a bunch of shell commands with different input? You could use a for loop or instead, use parallel. It's usually not installed on systems by default, but is only an apt or brew install away. Let's say, hypotheically, you wanted to clone a bunch of git repositories. You can do this:

parallel git clone {} ::: git@github.com/org/repo1.git git@github.com/org/repo2.git

Or you can pass in a file with the list of repos:

cat << EOF > input.txt
git@github.com/org/repo1.git
git@github.com/org/repo2.git
EOF

parallel git clone {} < input.txt