Linux shortcuts use

  
        

Use CTRL+Z when the command is run, forcing the current process to go to the background and stop it.

1. Let the process resume running (background)

(1)Use the command bg

Example:

zuii@zuii-desktop:~/unp/tcpcliserv$ ./tcpserv01

*Use CTRL+Z here, serv01 is stopped*< Br>

[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) If you stop several programs with CTRL+Z?

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* background running*

2. Restore the process to the foreground

Example:

zuii@zuii-desktop:~/Unp/tcpcliserv$ ./tcpserv04

[1]+ Stopped ./tcpserv04

zuii@zuii-desktop:~/unp/tcpcliserv$ fg

./tcpserv04< Br>

Summary:

(1) CTRL+Z stops the process and puts it into the background

(2) jobs displays the currently suspended process

(3) bg %N causes the Nth task to run in the background (with spaces before %)

(4) fg %N makes the Nth task run in the foreground

Default bg, fg without %N Indicates the operation of the last process!

Copyright © Windows knowledge All Rights Reserved