Tag Archives: man

How to find things in Linux man pages

There’s a couple of places (naturally).

It’s easy to be fooled and think: “anybody can type man man”. But in all fairness, you need to figure out which man page to look into, or what command to run and sometimes it’s just a blank.

In RHEL there is /usr/share/doc where there are some special places, for example /usr/share/doc/initscripts*/sysconfig.txt for all config files that relate to the boot-up process.
There is also /usr/share/man. In /usr/share/man/man5 which has all the level 5 man pages in gzip format. For example “man 5 yum.conf” you can find in /usr/share/man/man5/yum.conf.5.gz.

To open a man page you just type ‘man yum’. To get the man page for yum, or ‘man man’ for the manual for man.

To search through man-pages you can use either of these (they are the same):

man -k yum
apropos yum

While inside a man-page you can search by typing:
and then what you want to search for
and then ENTER.
Like this: /priority
This will hilight all the matched entries, you move to the next match with ‘n’.
This might differ between operating systems, it depends on which viewer is used to present the man page.

Sometimes these don’t find what you are looking for.
In that case you could manually move into /usr/share/man/man5 and hit:

zgrep priority *

to grep through the gzip files looking for any entries that says ‘priority’.

or, if you want to you could use this to search through all directories:

find . -name "*"|xargs zgrep -i priority

or even better (if you’re not looking for a language specific man page):

find /usr/share/man* -name "*"|xargs zgrep -i gpgcheck

These are all relatively slow though, if you read this and have any suggestions please let me know :)

SunOS 5.11 OpenSolaris Man Page Trick

Ever had to read a man page on a Solaris system?
You’ll see these

SunOS 5.11
System Administration Commands

on each page in the manpage, making it quite hard to read.

To make it more readable you can run this:
man $1|grep -v ‘SunOS 5.11’|grep -v ‘System Administration Commands’|less

With $1 being the command, for example mpathadm.

You could also put it in a bash script file, for example /usr/bin/man2, :

man $1|grep -v ‘SunOS 5.11’|grep -v ‘System Administration Commands’|less

Don’t forget to set executable permissions with chmod 755 on the script file so that normal users can run it.
Then instead of running man, run ‘man2 mpathadm’ and you’ll have a much more readable manpage.