Many new sysadmins find it very difficult to accomplish multiple tasks once a process takes longer. This often happens on servers where multiple applications are deployed.
In this context, we shall look into how to send processes to the background in Linux to free our terminal to get back control of our system.
Why send a process to the background in Linux system ?
The reason for this is to set the terminal free for the next command. Also whenever anything happens, most of the time either using a desktop or a server instance, we have access to a terminal only. At that time, a user doesn’t want it to be occupied by one job. Thanks to Linux, we can free the terminal from sending a job to the background and keep running new commands to get back to our system.
Running a process in Linux system
Running a process is as simple as running any other piece of software on Linux. We are going to run a trimage package for our illustration here. To run a trimage package, simply execute the following command:
You will see that the trimage package is running without any issues but the terminal is now stuck.
Sending a trimage to the background is as simple as hitting Ctrl + Z and it will stop the trimage job for the time being.
This happens when you run the command below and hit enter:
The bg Command will send the trimage process to the background. Trimage will keep running as usual whereas the terminal will be free to perform the next command.
If the package has a GUI, you can choose to close it from there, but if the package doesn't have any GUI you can simply use
This command will push the process to the foreground.
Now close the process as always we do use Ctrl + C and you'll return to a normal terminal.