Running the shell command from the terminal in the background under Linux

Source: Internet
Author: User
Tags gz file

Have you ever experienced a situation where you log in to a remote Linux host from the terminal software, Compress a large pile of files into a. tar.gz file, compressed for half an hour is not finished, at this time, suddenly you broke the network, you do not log on the remote Linux host, then the front half an hour will be naught, you are very angry ...

Under Linux, if the shell command you want to execute takes a very long time, and: (1) Your network is unstable, you may be disconnected at any time, or (2) you must close the terminal software (for example, SECURECRT) after executing the shell command.

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

Here's how:

(1) Enter the command:

Nohup your shell Command &

(2) Enter the terminal back to the shell command line;

(3) Enter the Exit command to exit the terminal:

Exit

(4) You can now close your terminal software, wait for enough time, let your shell command after the execution and then go up to see the results.

The Nohup command allows your shell command to ignore the sighup signal, which can be removed from the terminal and "&" allows your command to run in the background.

Running shell commands in the background in an off-terminal way has several advantages: as long as you have executed the command, your network outage will not have any effect on you, and you can shut down the terminal software.

Source: http://www.linuxidc.com/Linux/2011-05/35723.htm




From for notes (Wiz)

Running the shell command from the terminal in the background under Linux

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.