2

Sometimes I want to know what a specific flag means. For instance:

man apache2:
(...)
-L     Output a list of directives together with expected arguments and
              places where the directive is valid.

So is there a way to use something like "man apache2 -L" and it tells me only what -L means? Would be great so save on browsing the manual.

3 Answers3

1

No, not the way you want it. But do you know that you can search inside man? Most systems use less as man browser, so you can search with the / command (press h for more help). If you look for a specific switch, you can use the fact that these are formatted with an indentation at the beginning of the line most of the time and use a regexp:

^[ \t]+-link

will search for the string -link as first non-whitespace character of a line. This way, you will most likely find the actual explanation of the switch and not possible references in other sections.

Sven
  • 97,248
  • 13
  • 177
  • 225
0

I run man commandname and use / to type a search string like your example of -L.

ewwhite
  • 194,921
  • 91
  • 434
  • 799
0

If your version of man uses less as its pager you can use this Bash function to jump directly to the first occurrence of a given string in the man page:

mans () { local pages string; if [[ -n $2 ]]; then pages=(${@:2}); string="$1"; else         pages=$1; fi; man ${2:+--pager="less -p \"$string\""} ${pages[@]}; }

Usage:

mans '-E' grep

You can jump to a particular section of a series of pages:

mans DESCRIPTION grep sed awk

When you press q then Enter to exit one man page and go to the next, the search will be done in it, too.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148