nohup 的日志通常输出到 当前目录下的 nohup.out 文件,除非你在启动时重定向了输出。下面按常见场景说明怎么查看。
nohup python app.py &
日志文件:
nohup.out
查看方式:
tail -f nohup.out
tail -n 100 nohup.out
less nohup.out
grep "ERROR" nohup.out
nohup python app.py > app.log 2>&1 &
查看日志:
tail -f app.log
说明:
> app.log:标准输出2>&1:错误输出也写入同一个文件nohup python app.py > /dev/null 2> error.log &
查看错误:
tail -f error.log
find / -name nohup.out 2>/dev/null
ps -ef | grep app.py
或:
jobs -l
: > nohup.out
或:
truncate -s 0 nohup.out
✅ 使用:
nohup xxx > logs/app.log 2>&1 &
✅ 或配合:
logrotate 日志滚动supervisor / systemd 管理进程如果你愿意,可以把你的 启动命令贴出来,我可以帮你精确判断日志在哪、怎么看。