nohup 命令的输出文件默认位置是在当前工作目录下,生成的输出文件名为 nohup.out。如果你想指定输出文件的位置和名称,可以使用重定向操作符 > 或 >>。
nohup
nohup.out
>
>>
例如,将输出文件重定向到 /tmp/output.log:
/tmp/output.log
nohup your_command > /tmp/output.log 2>&1 &
这里,your_command 是你要执行的命令。2>&1 表示将标准错误(2)重定向到标准输出(1),& 表示在后台运行命令。
your_command
2>&1
&