跳轉到幫助/手冊文件中的特定標誌


1

假設我對特定標誌-T對命令ls意味著什麼感到好奇?有沒有辦法可以直接使用man ls ...跳到那個?

或者,這是一個略有不同的問題,因為它不是man,是否存在一種普遍接受的方法來跳入git help log之類的命令並直接進入-S標誌?

也許是相同的答案?!?

3

You can do that piping man though less and using the -p flag:

  -ppattern or --pattern=pattern
          The -p option on the command line is equivalent to specifying
          +/pattern; that is, it tells less to start at the first
          occurrence of pattern in the file.

Examples:

man ls | less -p -T
man git-log | less -p -S

Since you'll land inside less, the normal navigation keys work, of course.


0

It easy can be done by adding less command to special variable LESS:

LESS=+/-T man ls

where /-T is less command /find -Tpattern