Run commands parallel

Bash shell is the common linux command language.
Post Reply
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

Run commands parallel

Post by mister_v »

Hi,

Is it possible to run 2 commands parallel ?
I have 2 command that take some time to complete.
But i don want to wait until the first command is complete before starting the second one.
chris
Site Admin
Posts: 194
Joined: Mon Jul 21, 2008 9:52 am

Re: Run commands parallel

Post by chris »

You can send a task to the background,
with &. (and symbol)

Code: Select all

#command to the background
ls -la /home &

#get the process id
P1=$!;

#wait for it to finish
wait $P1;
Post Reply