LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 04-20-2008, 03:09 PM   #1
7stud
LQ Newbie
 
Registered: Feb 2007
Posts: 22

Rep: Reputation: 15
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?
 
Old 04-20-2008, 03:15 PM   #2
elliott678
Member
 
Registered: Mar 2005
Location: North Carolina
Distribution: Arch
Posts: 977

Rep: Reputation: 72
You can search simply by typing /-Bprefix and it will highlight all instances of that in the document.
 
Old 04-20-2008, 03:16 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
Old 04-20-2008, 03:19 PM   #4
elliott678
Member
 
Registered: Mar 2005
Location: North Carolina
Distribution: Arch
Posts: 977

Rep: Reputation: 72
Oops, I forgot the n part. You can check out the "Commands" section of less' man page for more options.
 
Old 04-20-2008, 03:21 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
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.

Last edited by bigrigdriver; 04-20-2008 at 03:29 PM.
 
Old 04-20-2008, 03:23 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
With all due respect, that's horrible! what about the 2nd line of the definition??
 
Old 04-20-2008, 03:27 PM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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.
 
Old 04-20-2008, 03:30 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
You do that regularly do you? I guess whatever suits people best. old habits die hard...
 
Old 04-20-2008, 03:32 PM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by acid_kewpie View Post
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?
 
Old 04-20-2008, 06:26 PM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

You could look at 'LINUX MAN PAGES ONLINE'. Any browser would work for you.
 
Old 04-21-2008, 03:04 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Quote:
Originally Posted by colucix View Post
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.
 
  


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
How do I get out of a man page? christianunix Linux - Newbie 4 10-17-2007 09:37 PM
man alsamixer not showing the man page nosaku Slackware 1 12-20-2004 09:52 AM
Is there a man page on how to use man page? jdruin Linux - Software 2 10-30-2004 10:29 AM
getting out of a man page! naijaguy Linux - Newbie 2 08-13-2004 10:28 PM
man page? chandan Linux - Newbie 1 07-16-2003 08:31 PM


All times are GMT -5. The time now is 10:13 PM.

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