less -jn
其中 n 是要跳转到的行号对我不起作用。它只是没有效果。我在 Ubuntu 11.04 上运行较少的版本 436。我也试过less --jump-target=200
和LESS='-j200' less filename
。
Gil*_*il' 12
ceving 的回答解释了-j
它的作用。我想你正在寻找
less +200 filename # jump to line 200 (the first line is 1)
Run Code Online (Sandbox Code Playgroud)
+NUM
跳转到第 NUM 行的切换在 unix 文本查看器(以 开头more
)和编辑器中相当普遍。简而言之,它是更通用的一个实例,+command
它允许您在打开文件后自动执行命令。其他常见示例:
less +200P filename # jump to the line containing byte 200
less +G filename # jump to the end of the file (G command)
less +/hello filename # jump to the first occurrence of hello
Run Code Online (Sandbox Code Playgroud)