Run shell commands out of the terminal in the background

Source: Internet
Author: User
Tags gz file

Have you ever encountered such a situation: from the remote Linux environment of the software, you have compressed a large pile of files into a .tar.gz file, which has not been completed for half an hour in a row. Then, suddenly you are disconnected from the network and you cannot log on to the remote Linux host, then the first half an hour will be exhausted, and you are very angry ......

In Linux, if the shell command you want to execute takes a very long time, and (1) your network is unstable, the network may be disconnected at any time; or (2) after you run the shell command, you must disable the terminal software (such as securecrt ).

Then you need to run the shell command in the background in a way that is separated from the terminal.

 

The method is as follows:

(1) enter the following command:

Nohup your shell command &

(2) Press enter to return the terminal to the shell command line;

(3) enter the exit command to exit the terminal:

Exit

(4) You can close your terminal software now. Wait for enough time to run your shell command and view the result.

 

 

Among them, the nohup command allows your shell command to ignore the sighup signal, that is, it can run it out of the terminal; "&" allows your command to run in the background.

 

Running shell commands in the background in the form of a terminal has the following advantages: as long as you have run the command, your network interruption will not affect you, and you can close the terminal software.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/learnhard/archive/2010/09/08/5871723.aspx

Related Article

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.