How To Run Parallel Jobs/Process/Programs in Bash

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-run-parallel-jobsprocessprograms-in-bash/
PINTEREST
PINTEREST
INSTAGRAM

We generally run jobs in bash in serial order. There is another way to run jobs which is named parallel. Running parallel means multiple jobs run at the same time.

Send Job To The Background

Send Job To The Background 

Send Job To The Background 

We can see from the output that after command is issued we have two line which show the commands processes and their related PID and there is also information about the background jobs in square brackets job id. Both command will start in background and will resume up to kill operation or exit.

Wait Before Running New Job

In some cases we may need to wait before running multiple parrellel jobs. We can use bash wait function to wait for finish previously started jobs. In this example we will want jobs j1 and j2 before running j3 .

GNU Parallel

GNU Parallel is very usefull tool which can start multiple jobs in parallel way. We will use the command parallel and specify the jobs we want to run after ::: . In this example we will run ping poftut.com and ping google.com commands in parrellel which will output same time.

parallel ::: “ping poftut.com” “ping google.com”

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-run-parallel-jobsprocessprograms-in-bash/
PINTEREST
PINTEREST
INSTAGRAM
LEARN MORE  Bash Command Basics

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)