我经常发现自己使用 less 来显示日志文件,其中包含数百个连续的、相同的行,这些行以设定的时间间隔附加到文件中。
例如,
something happened
something happened
something happened
something happened
something happened
something happened
something happened
... (100 identical lines later)
something happened
something happened
我使用 less 的 follow 选项来跟踪日志文件,但是一旦打印了一定数量的相同行,就无法判断日志文件是否仍在写入。
tail
与标志一起使用-f
可以解决这个问题,它允许我在其输出中放入换行符,换行符与文本一起浮动,显示文本的流动/移动。
$ tail -f a-terrible-log-file | (a few seconds later)
something happened | something happened
something happened | something happened
something happened | something happened
something happened | something happened
something happened |
something happened | something happened
something happened | something happened
something happened | something happened
something happened | something happened
something happened | something happened
something happened<C-j> | something happened
| something happened
something happened | something happened
something happened | something happened
something happened | something happened
something happened | something happened
有没有办法在 中显示线路流量/运动less
?
答案1
您可以从较少的内容开始-N
显示行号。