在 Debian 系统中,nohup 命令默认会把程序的**标准输出(stdout)和标准错误(stderr)**写入到当前目录下的 nohup.out 文件里。下面是常见查找和查看方式:
如果你是直接运行:
nohup your_command &
日志一般在:
./nohup.out
(也就是你执行命令时所在的目录)
查看内容:
cat nohup.out
tail -f nohup.out # 实时查看
less nohup.out
如果启动时是显式指定了日志:
nohup your_command > app.log 2>&1 &
那么日志就在:
app.log
查看:
tail -f app.log
find ~ -name nohup.out
sudo find / -name nohup.out
ps aux | grep your_command
ls -l /proc/<PID>/fd
其中:
1 → stdout(日志)2 → stderr例如:
ls -l /proc/12345/fd
如果你是用 systemd 启动的(不是裸 nohup):
journalctl -u your_service
以后推荐这样写:
nohup your_command > /var/log/myapp.log 2>&1 &
或更规范:
your_command >> /var/log/myapp.log 2>&1 &
如果你愿意,可以告诉我:
nohup 原命令)我可以帮你精准定位日志文件。