Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
OK, too bad it's not possible but / will help. –  user60129 Feb 4 '11 at 15:27
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.