Linux command background Execution tips Summary

Source: Internet
Author: User

1, the simplest method:

Command &

For example:

Top &

The job number and background process number are displayed

[114814

2. Running programs are put into the background

Ctrl-z

3. See what background processes and status

Jobs

4. Switch the background process to the foreground execution

FG Job number

5, let the background suspended process continue to execute

BG Job number

6, kill the background execution program

Kill %job Number

7, let the program in the background to execute, close the terminal does not quit

For example a continuous output program test.sh, as follows

 while [True]  do    Echo Hello     Sleep 1  Done

Want to continue execution after closing the terminal

Nohup./test. SH &

Default program output in the Nohup.out file

Check the process after exiting the terminal and re-login

PS grep Test. SH

Kill process, use Kill + process number

8, with the help of screen gadget to complete

Yum Install Screen

Enter screen and enter a new virtual terminal to perform the task.

Enter <Ctrl> + <a>, <D> exit current screen

<Ctrl> + <a>,  <D>

View all backend Terminals

Screen-list

Restore a terminal that has just been shut down

Screen-r

Linux command background Execution tips Summary

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.