Linux 101 : Background and Foreground processes



By adding an ampersand& - character to a command, we tell Linux to run it in the background and return to the shell prompt, allowing us to use the terminal - while our program runs in the background -

We run a command command in the background as below:


The ID of our background job 1.

To check our background programs, we use the below:


To end our background command, we use the following:


We check again our jobs:


There are none.

Remark:

The "2" number means an Interrupt signal "SIGINT".

We can bring a background process to the foreground using the following:


We put a foreground process on hold using the "Ctrl+z" keys.
To restart it again, we use the below:

Comments

Leave as a comment:

Archive