在 CentOS 上,nohup 的日志默认位置取决于你有没有手动重定向输出。
如果你是这样运行的:
nohup command &
那么日志默认会写到当前目录下的:
nohup.out
✅ 位置:
$(pwd)/nohup.out/ 或权限不足),会写到:$HOME/nohup.out
如果你这样运行:
nohup command > app.log 2>&1 &
那么日志就在:
app.log
(路径以你指定的为准,可以是相对路径或绝对路径)
find ~ -name nohup.out
或者查看某个进程的输出文件:
lsof -p PID
tail -f nohup.out
或
tail -f app.log
| 启动方式 | 日志位置 |
|---|---|
nohup cmd & |
./nohup.out 或 ~/nohup.out |
nohup cmd > log.txt & |
log.txt |
nohup cmd >/dev/null 2>&1 & |
无日志 |
如果你愿意,可以把你实际的 nohup 启动命令贴出来,我可以帮你精确判断日志在哪。