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