nohup 命令用于在后台运行程序,即使关闭终端或断开连接,程序也会继续运行。默认情况下,nohup 命令会将输出重定向到一个名为 nohup.out 的文件中。这个文件通常位于当前工作目录下。
要查看 nohup.out 文件的内容,可以使用以下命令:
cat nohup.out
如果你想查看实时更新的日志,可以使用 tail 命令:
tail -f nohup.out
如果你在运行 nohup 命令时指定了不同的日志文件,例如:
nohup your_command > my_log_file.log 2>&1 &
那么你需要查看指定的日志文件,例如:
cat my_log_file.log
或者使用 tail 命令查看实时更新的日志:
tail -f my_log_file.log
请注意,如果日志文件位于其他目录下,你需要提供完整的路径来查看日志文件。