Command Manual: Linux Run Command CTRL + Z

Source: Internet
Author: User

Although Microsoft is still so huge for Linux, many people are still applying Linux. Many people like the advantages of Linux. This article explains the role of CTRL + Z when running Linux commands. When running Linux commands, use 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

 
 
  1. Example:
  2. Zuii @ zuii-desktop :~ /Unp/tcpcliserv $./tcpserv01
  3. * CTRL + Z is used here, And serv01 is stopped *
  4. [1] + Stopped./tcpserv01
  5. Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ bg
  6. [1] +./tcpserv01 & * at this time, serv01 runs in the background *
  7. Zuii @ zuii-desktop :~ /Unp/tcpcliserv $

(2) What if I use CTRL + Z to stop several programs?

Example:

 
 
  1. Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ jobs
  2. [1]-Running./tcpserv01 &
  3. [2] + Stopped./tcpcli01 127.0.0.1
  4. Zuii @ zuii-desktop :~ /Unp/tcpcliserv $ bg % 1
  5. Bash: bg: Task 1 has been transferred to the background * run in the background *

2. Restore the process to the foreground

 
 
  1. Example:   
  2. zuii@zuii-desktop:~/unp/tcpcliserv$ ./tcpserv04   
  3. [1]+ Stopped ./tcpserv04   
  4. zuii@zuii-desktop:~/unp/tcpcliserv$ fg   
  5. ./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! I hope you can learn the role of CTRL + Z when running commands in Linux.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.