Page 1 of 1

Run commands parallel

Posted: Sun Oct 16, 2022 1:23 pm
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.

Re: Run commands parallel

Posted: Sun Oct 16, 2022 7:43 pm
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;