Question: using the less command in any linux shell (i'm using bash as probably most people do), is there a way to search a file only for it's commands or options?
So, to be more precise: if i want to quickly find the description for one special option in a man-page, is there a special search syntax to quickly jump to the corresponding line explaining that specific command?
example:
if i type:
man less
and i want to quickly find the description for the "-q" command,
is there a search syntax to directly jump to that line?
If I type /-q, it finds all occurences of "-q" everywhere in the file, so I get around 10-20 hits, of which only one is the one i was looking for..
So I'm just hoping there is a better/quicker way to do this.. (not to important though :D)
In
man, options are generally described with the option name in bold at the start of the line.So, if you are looking for the option
-q, then the search command would be/^\s*-q\>The regex
^\s*-q\>reads as follow:^start of a line\s*any number of spaces (including none)-qthe option name you are looking for\>the end of the word