Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash: GNU Parallel with Curl
# do it once
seq 1 | parallel -n0 "curl -H 'Content-Type: application/json' -X POST -d '{\"url\":\"\"}'"
# do it twice
seq 2 | parallel -n0 "curl -H 'Content-Type: application/json' -X POST -d '{\"url\":\"\"}'"
# do it 4 times, but at 2 a time
seq 4 | parallel -n0 -j2 "curl -H 'Content-Type: application/json' -X POST -d '{\"url\":\"\"}'"
# you can also put all your commands into a file
echo "ls\nls" > somefile
cat somefile | parallel
# finally, just straight command line parameters
parallel echo ::: a b c
# by default, it runs as many jobs in parallel as there are cores in your computer
# if you try and set more jobs than there are cores, they will be concurrent, but
# they will only ever be parallel up to your core count
# for httpie use the --ignore-stdin flag, or else it gets mixed up
seq 1 | parallel -n0 "http --ignore-stdin POST url="
Copy link

JoyJava commented Jun 12, 2018

git clone

Copy link

realModusOperandi commented Feb 11, 2020

git clone

Copy link

Bugadder commented Jul 13, 2021

git clone

Copy link

gempesaw commented Jul 20, 2021

git clone

Copy link

nilsdev commented Apr 8, 2022

git clone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment