在nohup命令中重定向标准错误(stderr)到文件,可以使用以下方法:
2>操作符将标准错误重定向到文件。例如,如果你想将错误信息重定向到名为error.log的文件,可以使用以下命令:nohup your_command 2> error.log &
这将在后台运行your_command,并将所有错误信息写入error.log文件。
nohup your_command > output_and_error.log 2>&1 &
这会将标准输出和标准错误都重定向到output_and_error.log文件,并在后台运行your_command。
nohup your_command > output.log 2> error.log &
这会将标准输出重定向到output.log文件,将标准错误重定向到error.log文件,并在后台运行your_command。