Skip to content

Instantly share code, notes, and snippets.

@mjpost
Last active October 27, 2022 13:19
Show Gist options
  • Save mjpost/3167f6bd0e5bb38f3419554b129d22b4 to your computer and use it in GitHub Desktop.
Save mjpost/3167f6bd0e5bb38f3419554b129d22b4 to your computer and use it in GitHub Desktop.
Command line use of GNU parallel
# I can never remember syntax for GNU parallel
## Treat STDIN as a pool of commands to run, running the command for each, at most j in parallel
cat commands.txt | parallel -j 10
## Download a long list of files in parallel
cat files.txt | parallel -j 10 wget -q {}
## Start 10 parallel instances of COMMAND with FLAGS. Feed STDIN in 10k blocks to these commands. Assemble the outputs in order (-k).
cat large_input.txt | parallel -j 10 --pipe -k --block-size 10m COMMAND FLAGS > output.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment