1 post

Running Bash Commands in Parallel

Let's imagine you have a script like below and you want to make it faster.


echo "Started at `date +%Y-%m-%d\ %H:%M:%S`"

echo "Starting job 1"
sleep 5

echo "Starting job 2"
sleep 5

echo "Finished at `date +%Y-%m-%d\ %H:%M:%S`"

If it's ok to run jobs in parallel, you can easily do it with bash background jobs.