The role of CTRL + Z when running commands in linux
Source: Internet
Author: User
The role of CTRL + Z when running commands in linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. 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
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!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service