LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   searching a man page? (https://www.linuxquestions.org/questions/linux-newbie-8/searching-a-man-page-636638/)

7stud 04-20-2008 02:09 PM

searching a man page?
 
Hi,

Once you have a man page open for a particluar command, how can you search the man page for a particular option? For example, I am trying to search man gcc. That man page is extremely long and I want to find out what the -I option does. How can I find the relevant description? In the preamble for that man page, it shows:

Code:

  Directory Options
          -Bprefix  -Idir  -iquotedir  -Ldir  -specs=file  -I-

Is there a way to click on one of those options to go to its description?

elliott678 04-20-2008 02:15 PM

You can search simply by typing /-Bprefix and it will highlight all instances of that in the document.

acid_kewpie 04-20-2008 02:16 PM

well man pages are just text, man isn't responeible for things like that, but man uses less as the default pager, which responds very mich like vi / vim, so most non-editing vi commands work. in your case, just do "/ -I " to find it. also hitting n will go to the next ocurrence shoudl there be one.

elliott678 04-20-2008 02:19 PM

Oops, I forgot the n part. You can check out the "Commands" section of less' man page for more options.

bigrigdriver 04-20-2008 02:21 PM

man gcc | grep -A 15 'I dir'

will find -I dir pluss the 15 lines following that match.

Note: if you add the - with the I, grep will choke up for some reason.

acid_kewpie 04-20-2008 02:23 PM

With all due respect, that's horrible! what about the 2nd line of the definition??

colucix 04-20-2008 02:27 PM

Eventually you can save the manual pages as text files and open them with your favourite editor. The command is
Code:

man gcc | col -b > man_gcc.txt
A lot of distributions have also a GUI to browse man pages. For example on OpenSUSE all the installed manual pages can be accessed from the KDE Help Center.

acid_kewpie 04-20-2008 02:30 PM

You do that regularly do you? I guess whatever suits people best. old habits die hard...

colucix 04-20-2008 02:32 PM

Quote:

Originally Posted by acid_kewpie (Post 3127208)
You do that regularly do you? I guess whatever suits people best. old habits die hard...

Chris, what are you talking about? Have I told or done something wrong?

onebuck 04-20-2008 05:26 PM

Hi,

You could look at 'LINUX MAN PAGES ONLINE'. Any browser would work for you.

acid_kewpie 04-21-2008 02:04 AM

Quote:

Originally Posted by colucix (Post 3127212)
Chris, what are you talking about? Have I told or done something wrong?

well that's not my place, and in now way authorative, just seems a long way round to do not much. You could actually get a similar result by changing the manpager to that editor probably.


All times are GMT -5. The time now is 08:50 PM.