Linux中nohup启动不输出日志怎么解决
在Linux中,使用nohup命令启动后台进程时,输出会被重定向到nohup.out文件中。如果需要查看实时日志,可以通过以下方式解决:
-
使用tail命令实时查看日志:
tail -f nohup.out
-
将nohup命令的输出重定向到其他文件,并通过tail命令查看:
nohup command > logfile & tail -f logfile
-
使用tee命令将输出同时重定向到文件和标准输出:
nohup command | tee logfile
-
在nohup命令中使用输出重定向符号将输出重定向到/dev/null,这样输出将被丢弃:
nohup command > /dev/null &
请根据实际需求选择合适的方法。
版权声明
本文仅代表作者观点,不代表米安网络立场。
上一篇:linux怎么设置时区和时间 下一篇:如何编译linux内核
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。