The most significant advantage of executing the running process in the background is that you can do any other task simultaneously while other processes are running in the background. So, more processes can be completed in the background while you are working on different processes. It can be achieved by adding a special character
& at the end of the command.
Generally applications that take too long to execute and doesn't require user interaction are sent to background so that we can continue our work in terminal.
For example if you want to download something in background, you can:
wget https://url-to-download.com/download.tar.gz &
When you run the above command you get the following output:
Here 1 is the serial number of job and 2203 is PID of the job.
You can see the jobs running in background using the following command:
When you execute job in background it give you a PID of job, you can kill the job running in background using the following command:
Replace the PID with the PID of the job. If you have only one job running you can bring it to foreground using:
If you have multiple jobs running in background you can bring any job in foreground using:
# with serial number of the job.