在 Debian 系统中,使用 nohup
命令运行程序时,默认情况下,输出会被重定向到当前目录下的 nohup.out
文件。如果你没有指定输出文件,那么 nohup.out
就是日志文件的位置。
例如,如果你运行以下命令:
nohup your_command &
那么 your_command
的输出将被追加到当前目录下的 nohup.out
文件中。
如果你指定了输出文件,例如:
nohup your_command > output.log 2>&1 &
那么 your_command
的标准输出和标准错误都会被重定向到 output.log
文件中。
你可以通过以下命令查看 nohup.out
文件的内容:
cat nohup.out
或者使用 tail
命令实时查看文件的最新内容:
tail -f nohup.out
如果你指定了其他的输出文件,比如 output.log
,那么你可以查看该文件的内容:
cat output.log
或者使用 tail
命令实时查看:
tail -f output.log
请注意,如果 output.log
文件已经存在,使用 >
会覆盖原有内容,而使用 >>
会追加内容到文件末尾。