linux - tail -f 一直显示 "Killed"

标签 linux shell command-line tail

做的时候

tail -f /var/log/apache2/access.log

它显示日志然后

Killed

我必须重新执行 tail -f 才能看到新日志。

如何让 tail -f 持续显示日志而不杀死自己?

最佳答案

我要做的第一件事是尝试使用 --follow 而不是 -f。您的问题可能会发生,因为您的日志文件正在轮换。从手册页:

With --follow (-f), tail defaults to following the file descriptor, which means that even if a tail'ed file is renamed, tail will continue to track its end. This default behavior is not desirable when you really want to track the actual name of the file, not the file descriptor (e.g., log rotation). Use --follow=name in that case. That causes tail to track the named file in a way that accommodates renaming, removal and creation.*

关于linux - tail -f 一直显示 "Killed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22988430/

相关文章:

javascript - 网络包错误 : output filename not configured

linux - 如何为 Redhat Linux bash shell 编写 shell 脚本

macos - 苹果机 : gnome-terminal equivalent for shell script

windows - PUSHD 命令后批处理文件 ECHO 不起作用

c# - Unity Linux 包导出正在修改我的 DLL

linux - ls 查找所有以 ./开头的目录

c - 如何将 readlink 与动态内存分配一起使用

PHP 无法执行 xcodebuild,如何解决?

linux - 开关盒 : Confusing error in "Syntax error: word unexpected (expecting "in")"

java - 如何在没有任何 IDE 的情况下运行基本的 Spring MVC 应用程序?