温馨提示×

centos nohup日志在哪查找

小樊
50
2026-09-12 02:23:14
栏目: 智能运维

在 CentOS 中,nohup 命令默认会把程序的**标准输出(stdout)和标准错误(stderr)**重定向到一个日志文件里。

1. 默认日志位置

如果你是这样运行的:

nohup your_command &

那么日志默认会生成在当前目录下,文件名为:

nohup.out

查找方式:

ls -l nohup.out
cat nohup.out
tail -f nohup.out

2. 自己指定了日志文件

如果你运行时指定了输出文件,例如:

nohup your_command > app.log 2>&1 &

那日志就在你指定的文件里:

tail -f app.log

3. 找不到 nohup.out 的常见情况

  • 你在 家目录 运行的命令,但后来切换了目录
    可以全局搜一下:
    find / -name nohup.out 2>/dev/null
    
  • 程序没真正启动或马上退出,可能没生成日志
  • 使用了 systemd / crontab 等方式启动,不走 nohup

4. 查看进程确认日志

ps -ef | grep your_command

lsof -p <PID> | grep txt

如果你愿意,可以把你具体的 nohup 启动命令发出来,我可以帮你精准定位日志文件。

0