Linux nohup command details nohup command and its output file nohup command: If you are running a process and you think the process will not end when you exit the account, you can use the nohup command. This command can continue running the corresponding process after you exit the account/Close the terminal. Nohup means not to suspend (n ohang up ). Generally, it is in the nohup format in linux: www.2cto.com nohup command or nohup command & the difference is that the command line with &, even if terminal (terminal) is disabled, or the computer's dead-end program is still running (provided that you submit the program to the server); the hosts file is not conducive to search for results and debugging programs. Therefore, it is very convenient to redirect the output. The following describes the standard output, standard input and standard error. In fact, we have been using it all the time, but we did not notice that www.2cto.com, for example,>. /command. sh> output # Here> is the standard output symbol, which is actually the abbreviation of 1> output>. /command. sh 2> output # Here 2> is to output a standard error to the output file. 0 <indicates the standard input. Next, go to the question and redirect the background command> nohup./command. sh> output 2> & 1 & explanation: the previous nohup and later & I think everyone can understand it.
This means that the standard error (2) is redirected to the standard output (1), and the standard output is imported into the file output, the result of www.2cto.com is a standard error and the standard output is imported into the file output. The reason why standard errors need to be redirected to standard output is that there is no buffer for standard errors and stdout does. This will cause the> output 2> output file output to be opened twice, and stdout and stderr will compete to overwrite it. This is definitely not what I want.
This is why someone writes it: nohup. /command. sh> output 2> cause of output Error ############################ at the end of the article/ the role of the dev/null file is a bottomless pit, everything can be directed here, but it cannot be opened. So stdou and stderr are usually very large. When you don't care about it, you can use stdout and stderr to direct it here>./command. sh>/dev/null 2> & 1