在Linux中,nohup命令用于在后台运行程序,即使关闭终端或断开连接,程序也会继续运行
nohup command > output.log 2>&1 & 这里,command是你要运行的程序,output.log是你要将输出保存到的文件。2>&1表示将标准错误(stderr)重定向到标准输出(stdout),&表示将命令放入后台运行。
nohup command > output.log & 在这种情况下,标准错误(stderr)将仍然显示在终端上。
nohup command > output.log 2> error.log & 这里,output.log是标准输出(stdout)的目标文件,error.log是标准错误(stderr)的目标文件。
注意:在使用nohup命令时,建议使用绝对路径来指定要运行的程序和输出文件的路径。