Linux system how to switch the foreground process and background process

  

In the Linux system, if there is no relevant settings, then close a process, then he terminates, and when you reopen the process, you must start from the beginning. The solution is to turn the foreground process to the background. So how does the Linux system switch between foreground and background processes?

In a terminal in firefox, it opens firefox, but when you close the terminal or ctrl + c when forced to terminate, firefox also will be closed. You can add an & after the execution, so that it works in the background.

First, Shell support role control, have the following command:

1. command & let the process run in the background

2. jobs – l view the background running process

3. fg %n Let the process running in the background get to the foreground

4. bg %n Let process n go to the background;

PS:“n” The process number that was viewed for the jobs.

Second, execute the command & switch to the background

When running the command in the Linux terminal, add the & symbol at the end of the command, you can let the program run in the background

root@Ubuntu$ . /tcpserv01& Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved