Jump to content

Searching Man Pages (Newbies)


Leo
 Share

Recommended Posts

Here's one for the newbies like me who have trouble with large Man pages (like for mplayer). I am sure I picked this up from somewhere else but cannot remember where (so apologies if it was your idea).

 

Instead of trawling through lengthy man pages simply type at the command line

man <man page description>|grep -C <lines to show> <search text>

for example

man mplayer|grep -C 3 dvd

This would return three lines above and below every instance of the string "dvd" in the man pages for mplayer. It will also separate out each block of text with "-------"

 

This has really helped me recently whilst trying to get mplayer to work.

 

Leo

Link to comment
Share on other sites

Good tip, but I have a little complaint ;) doing it your way you loose the whole by showing only a few lines of each match. IMHO is better to use the search feature of the man pages viewer: ie press '/' and enter the string to search, then the viewer will move to the next string match.

 

"man man" for more info

Link to comment
Share on other sites

Also very helpful if you don't know what man page to look for:

[root@omarserenity tmp]# man man



<<snip>>



-K     Search for the specified string in  *all*  man  pages.  Warning:

             this  is  probably  very  slow!  It  helps to specify a section.

             (Just to give a rough idea, on my machine  this  takes  about  a

             minute per 500 man pages.)



<<snip>>

Link to comment
Share on other sites

Also very helpful if you don't know what man page to look for:

[root@omarserenity tmp]# man man



<<snip>>



-K     Search for the specified string in  *all*  man  pages.  Warning:

             this  is  probably  very  slow!  It  helps to specify a section.

             (Just to give a rough idea, on my machine  this  takes  about  a

             minute per 500 man pages.)



<<snip>>

 

As for aru's / method, I don't see that in the manpage, but I could have overlooked it. Any other tricks in there that I don't see?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...