nohup
命令用于在后台运行程序,即使关闭终端也不会中断
nohup your_command > output.log 2>&1 &
这里,your_command
是你要运行的命令。>
将标准输出重定向到 output.log
文件。2>&1
将标准错误(stderr)重定向到标准输出(stdout),这样错误信息也会被写入 output.log
文件。最后的 &
将命令放入后台运行。
nohup your_command > output.log 2> error.log &
在这个例子中,标准输出被重定向到 output.log
文件,而标准错误被重定向到 error.log
文件。
注意:在使用这些命令时,请确保将 your_command
替换为你要执行的实际命令。