It is a very common need to run a command or process in a server in the background. This is especially true when you are running the command over a SSH connection, since the connection can be dropped due to multitude of reasons, it’s always better to run that command in the background.
The command is very simple, you just need to append an ampersand symbol at the end of the command, the syntax is given below
$ the-command -with -options to execute &
for example, you want to run a long running python or php script, and the file name is `my-long-running-script.py`
$ python3 my-long-running-script.py &
now you will see an output similar to the following in the terminal
this means that the job number for your background job is
1, So when you want to bring this to the foreground use the
now this will bring the job number 1 to the foreground so that you can interact with it.
when you want to see all the jobs running in the background, use the
jobs utility this will list out all the background jobs that.