在 Linux 中对日志文件使用 less 命令时如何转到下一个找到的结果?

bba*_*ing 4 less linux-terminal

我有一个日志文件,我可以在该文件上使用,我知道如何使用+less转到日志文件的底部,然后用于在文本文件中查询。shiftG?

我不知道该怎么做是当我转到日志文件的底部并找到我的第一个错误或我曾经搜索过的内容以及?如何到达下一个错误时?我希望从下到上不断地了解日志文件中的每个错误。

gro*_*taj 6

答案在手册中man less

       n      Repeat previous search, for N-th line containing the last
              pattern.  If the previous search was modified by ^N, the
              search is made for the N-th line NOT containing the
              pattern.  If the previous search was modified by ^E, the
              search continues in the next (or previous) file if not
              satisfied in the current file.  If the previous search was
              modified by ^R, the search is done without using regular
              expressions.  There is no effect if the previous search
              was modified by ^F or ^K.

       N      Repeat previous search, but in the reverse direction.
Run Code Online (Sandbox Code Playgroud)

  • 当使用“less”时(即阅读文本时),只需按“?”即可显示相当多的帮助。无需提起男人。;-) (2认同)