CentOS 中尾部多个文件
我想在 CentOS 中跟踪多个文件(并跟踪它们),我已经尝试过:
tail -f 文件1 文件2 文件3
但输出非常不友好
我也看过 multitail 但找不到 CentOS 版本。
我还有什么其他选择?
I want to tail multiple files (and follow them) in CentOS, I've tried this:
tail -f file1 file2 file3
but the output is very unfriendly
I've also had a look at multitail but can't find a CentOS version.
What other choices do I have?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Multitail 可在 rpmforge 存储库中用于 CentOS。 要添加 rpmforge 存储库,请检查有关第 3 方存储库的文档。
Multitail is available for CentOS in rpmforge repos. To add rpmforge repository check the documentation on 3rd Party Repositories.
我发现这里描述的解决方案在centos上运行良好:
链接是http://www.thegeekstuff.com/2009/09/multitail-to-view-tail-f-output-of-multiple-log-files-在一个终端/
感谢 Ramesh Natarajan
I found the solution described here work well on centos:
The link is http://www.thegeekstuff.com/2009/09/multitail-to-view-tail-f-output-of-multiple-log-files-in-one-terminal/
Thanks to Ramesh Natarajan
您可以通过在 Emacs 子窗口中打开 tail -f 的多个实例来模拟多尾。
You could simulate multitail by opening multiple instances of tail -f in Emacs subwindows.
我通常只是打开另一个 xterm 并在那里运行单独的“tail -f”。
否则,如果我使用“screen”工具,我将在那里设置单独的“tail -f”命令。 我不太喜欢这样,因为在使用 Page Up 和 Page Down 键之前需要敲击几次按键才能在屏幕中滚动。 我更喜欢只使用 xterm 的滚动条。
I usually just open another xterm and run a separate 'tail -f' there.
Otherwise if I'm using the 'screen' tool, I'll set up separate 'tail -f' commands there. I don't like that as much because it takes a few keystrokes to enable scrolling in screen before using the Page Up and Page Down keys. I prefer to just use xterm's scroll bar.
您可以使用 watch 命令,我用它同时尾部两个文件:
watch -n0 tail -n30 file1 file2
You can use the watch command, i use it to tail two files at the same time:
watch -n0 tail -n30 file1 file2
对一个老问题的更好答案...
我在 .bashrc 中创建了一个 shell 函数(显然假设您使用 bash 作为 shell)并使用 tmux。 您可能可以使这一切变得更加复杂,并且在没有临时文件的情况下完成它,但是如果您试图确保名称中带有空格或其他奇怪字符的文件仍然有效,那么引用就很难看。
A better answer to an old question...
I create a shell function in my .bashrc (obviously assumes you're using bash as your shell) and use tmux. You can probably complicate this a whole lot and do it without the tempfile, but the quoting is just ugly if you're trying to ensure that files with spaces or other weird characters in the name still work.