LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-13-2011, 11:59 PM   #1
kingisw
LQ Newbie
 
Registered: Oct 2011
Posts: 2

Rep: Reputation: Disabled
Exact Keyword Search within Man Pages?


Noob question...

How do you perform an exact keyword (case sensitive, the whole word only) search within a man page (say, "man bash")?

I know you can perform a generic search by pressing "/" and typing in the keyword.

Gracias
 
Old 10-14-2011, 09:41 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
You can use the '\b' to match word boundaries in the search expression, eg
Code:
/\bor\b
will search for the word "or" as a standalone word (case sensitive).
 
Old 10-14-2011, 10:39 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Note that what you're really doing here is using your pager's search function. By default most distributions use less as the display program for man pages. Hitting 'h' when inside less will bring up its help page.

less' search feature uses regular expressions by default. According to the help page, hitting ctrl+R just after calling up the search field will turn this off.

Of course you can also just format your regex so that it only matches what you want, as neonsignal demonstrated. Learning how to use regular expressions effectively is one of the most useful skills to have, as they are supported by so many programs.


This is a pretty good regular expressions tutorial:
http://www.grymoire.com/Unix/Regular.html
 
1 members found this post helpful.
Old 10-14-2011, 11:21 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 387Reputation: 387Reputation: 387Reputation: 387
As said by others, it comes down to the pager you use. That's usually 'less' ('more' in ancient OSes).

But if you are more happy using GUIs or something else it can be done as well. You can just google for your man page and then use the search function in your browser, or use the kde man:// ioslave, etc. As always, there are lots of alternatives...
 
Old 10-14-2011, 02:44 PM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Not exactly what you asked, but you might want to look at the -k and -K options of the man command. I find those quite useful when I want to find a command that does something, but I don't know which command to use.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Search in man pages CartmanYO Linux - General 13 06-11-2010 08:13 AM
how to search man pages parnal88 Linux - Newbie 7 05-06-2010 12:43 AM
[Search function]short keyword limitations Wim Sturkenboom LQ Suggestions & Feedback 2 09-01-2009 12:11 PM
Search the 'man' pages mr tim esquire Linux - Newbie 6 07-28-2008 11:37 PM
Search all man pages for a phrase suguru Linux - Software 1 09-12-2004 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration