如何跟踪日志,同时避免启用水平滚动换行?

如何跟踪日志,同时避免启用水平滚动换行?

在终端中,如果我不想让程序换行的日志,我可以将它们通过管道传输到less -S.

Ctrl但是,除非 I + ,否则用键盘进行水平滚动不起作用,C之后,我不知道如何重新进入跟随模式。

问题:

  1. Ctrl使用+脱离跟随模式后,我只能水平滚动吗C
  2. 之后有什么办法可以重新进入跟随模式吗?

如果没有,是否有更方便的方法可以让我在 1. 不换行和 2. 不剪切(需要时允许水平滚动)的情况下跟踪日志文件的滚动?

答案1

man less:

       F      Scroll forward, and keep trying to read when the end of file  is
              reached.   Normally  this  command would be used when already at
              the end of the file.  It is a way to monitor the tail of a  file
              which  is  growing  while  it is being viewed.  (The behavior is
              similar to the "tail -f" command.)  To  stop  waiting  for  more
              data,  enter the interrupt character (usually ^C).  On some sys‐
              tems you can also use ^X.

相关内容