在 Debian 系统中,nohup 命令用于在后台运行程序,即使关闭终端或断开连接,程序也会继续运行。默认情况下,nohup 会将输出重定向到名为 nohup.out 的文件中。要查询 nohup 日志,可以使用以下方法:
cat 命令查看 nohup.out 文件的内容:cat nohup.out
tail 命令实时查看 nohup.out 文件的最新内容:tail -f nohup.out
grep 命令搜索特定的关键字或模式:grep '关键字' nohup.out
less 或 more 命令分页查看 nohup.out 文件的内容:less nohup.out
或者
more nohup.out
nohup 命令时指定输出文件:nohup your_command > output.log 2>&1 &
这将把标准输出和标准错误都重定向到 output.log 文件中。然后,你可以使用上述方法查询 output.log 文件。