在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。