Patterns can be regular expressions, for example, you could search for the word "option" by typing:
/[Oo]ption
Or find all of the long arguments with:
/(--)[a-Z]
To cancel the search, hit Ctrl+C.
Some useful quantification operators are:
? for zero or one of the preceding expression
* for zero or more of the preceding expression
+ for one or more of the preceding expression
And expressions can be "grouped" with parentheses, as in (--)+ (for two or more dashes).
[a-Z] is a sequence (others include [0-9], [a-z], and so on). Sequences can be combined, as in [a-Z0-9]. You can also invert expressions with the ^ operator, e.g. (--)[^a-Z]+ for all long arguments that start with anything other than a letter.
Another useful operation is Union (|), as in color|colour, which finds every occurrence of either "color" or "colour" (this is sometimes called boolean OR).
If you are searching for strings containing some of these "reserved" characters (like ?, *, +), prefix them with a \ (i.e. /\+k to search for +k).
To jump through the results, press N (forwards) and Shift+N (backwards).
There is also a way to search across all manpages:
man -K "Hello World"
The man program will open the first match, and after you close it with q, offer you to
Minor appendix to the excellent answer from Stefano:
man uses less when no other pager specified. So you can search either with / or with ?.
If you search with / then you search forward and you use n to find the next match and N to find previous match and if you search with ? (search backward) n will search previous match and N will search the next match.
Use man less for the details.
Also you may use man -wK word to list out all manual files with some word.
If you are already in the man page, / search is easy to use, but I prefer to specify my search word with the man command, so it opens directly on the first occurrence of the term.
This is fairly straight forward with a pipe:
man ksh | less +/LINENO
But if you wanted to stick only to man options, it seems to be very roundabout. You have to override the default output pager (less -f) with the -P option.
Just hit /, and type your search pattern.
Patterns can be regular expressions, for example, you could search for the word "option" by typing:
Or find all of the long arguments with:
To cancel the search, hit Ctrl+C.
Some useful quantification operators are:
And expressions can be "grouped" with parentheses, as in
(--)+
(for two or more dashes).[a-Z]
is a sequence (others include[0-9]
,[a-z]
, and so on). Sequences can be combined, as in[a-Z0-9]
. You can also invert expressions with the^
operator, e.g.(--)[^a-Z]+
for all long arguments that start with anything other than a letter.Another useful operation is Union (
|
), as incolor|colour
, which finds every occurrence of either "color" or "colour" (this is sometimes called boolean OR).If you are searching for strings containing some of these "reserved" characters (like
?
,*
,+
), prefix them with a\
(i.e./\+k
to search for+k
).To jump through the results, press N (forwards) and Shift+N (backwards).
There is also a way to search across all manpages:
The
man
program will open the first match, and after you close it withq
, offer you toMinor appendix to the excellent answer from Stefano:
man
usesless
when no other pager specified. So you can search either with/
or with?
.If you search with
/
then you search forward and you usen
to find the next match andN
to find previous match and if you search with?
(search backward)n
will search previous match andN
will search the next match.Use
man less
for the details.Also you may use
man -wK word
to list out all manual files with some word.If you are already in the man page,
/
search is easy to use, but I prefer to specify my search word with theman
command, so it opens directly on the first occurrence of the term.This is fairly straight forward with a pipe:
But if you wanted to stick only to
man
options, it seems to be very roundabout. You have to override the default output pager (less -f
) with the-P
option.GUI Methods
If you have Ubuntu Desktop version installed you can search graphically.
Gnome Help
Gnome help uses
yelp
program. Instead of typingman ls
for the CLI man page you can typeyelp man:ls
and view in GUI window:Once loaded you can use Control + F to search.
Browser
I open the man page on the internet and use my browsers search feature Control + F.
For example if in the terminal I type in
man yad
in my browser I would typelinux man yad
.You sometimes need to pay attention that the internet version can sometimes have newer or older list of arguments but this has rarely happened to me.
The advantages of internet manpages goes beyond search facility and includes superior scrolling plus easier copying to clipboard.