& Nbsp; use CTRL + Z to force the current process to be switched to the background and stop it. 1. run the process again (in the background) (1) run the command bgExample: zuii @ zuii-desktop :~ /Unp/tcpcliserv $./tcpserv01 * CTRL + Z is used here, and serv01 is in the stopped State * [1] + Stoppe
Run the command CTRL + Z to force the current process to be switched to the background and stop it.
1. resume the process (background)
(1) use the command bg
Example:
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $./tcpserv01
* CTRL + Z is used here, and serv01 is stopped *
[1] + Stopped./tcpserv01
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ bg
[1] +./tcpserv01 & * at this time, serv01 runs in the background *
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $
(2) What if I use CTRL + Z to stop several programs?
Example:
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ jobs
[1]-Running./tcpserv01 &
[2] + Stopped./tcpcli01 127.0.0.1
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ bg % 1
Bash: bg: Task 1 has been transferred to the background * run in the background *
2. restore the process to the foreground
Example:
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $./tcpserv04
[1] + Stopped./tcpserv04
Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ fg
./Tcpserv04
Summary:
(1) CTRL + Z stop the process and put it in the background
(2) jobs displays the currently paused processes
(3) bg % N run the nth task in the background (there is a space before %)
(4) fg % N run the nth task on the foreground
Bg by default. if fg does not contain % N, the last process is operated!