Jyothi's Weblog

« Printing basics on... | Main | Blogsworth »

http://blogs.sun.com/jyothi/date/20070313 Tuesday March 13, 2007

Using man pages in Solaris

Man (short for manual) pages in Solaris provide detailed information about the Solaris system.The man command is used to find and display reference manual pages. To use the man pages,first set your MANPATH variable by adding the location of your man pages to your .bashrc file. For example,

export MANPATH=/usr/man:/usr/openwin/share/man

To list out all the options associated with the man command itself, type

$ man man

For instance

$ man -k command-name

will list out one line summaries of all the commands that contain the command-name keyword. For example,

$ man -k grep

 will give this output.

bzegrep         bzgrep (1)      - search possibly bzip2 compressed files for a regular expression
bzfgrep         bzgrep (1)      - search possibly bzip2 compressed files for a regular expression
bzgrep          bzgrep (1)      - search possibly bzip2 compressed files for a regular expression
egrep           egrep (1)       - search a file for a pattern using full regular expressions
fgrep           fgrep (1)       - search a file for a fixed-character string
fmlgrep         fmlgrep (1f)    - search a file for a pattern
grep            grep (1)        - search a file for a pattern
gzegrep         gzgrep (1)      - search possibly compressed files for a regular expression
gzfgrep         gzgrep (1)      - search possibly compressed files for a regular expression
gzgrep          gzgrep (1)      - search possibly compressed files for a regular expression
nisgrep         nismatch (1)    - utilities for searching NIS+ tables
pgrep           pgrep (1)       - find or signal processes by name and other attributes
pkill           pgrep (1)       - find or signal processes by name and other attributes
bzegrep         bzgrep (1)      - search possibly bzip2 compressed files for a regular expression
bzfgrep         bzgrep (1)      - search possibly bzip2 compressed files for a regular expression
bzgrep          bzgrep (1)      - search possibly bzip2 compressed files for a regular expression
egrep           egrep (1)       - search a file for a pattern using full regular expressions
fgrep           fgrep (1)       - search a file for a fixed-character string
fmlgrep         fmlgrep (1f)    - search a file for a pattern
grep            grep (1)        - search a file for a pattern
gzegrep         gzgrep (1)      - search possibly compressed files for a regular expression
gzfgrep         gzgrep (1)      - search possibly compressed files for a regular expression
gzgrep          gzgrep (1)      - search possibly compressed files for a regular expression
nisgrep         nismatch (1)    - utilities for searching NIS+ tables
pgrep           pgrep (1)       - find or signal processes by name and other attributes
pkill           pgrep (1)       - find or signal processes by name and other attributes

 

To list all man pages for the command-name within the search path(within MANPATH), type

$ man -l command-name

For example,

$ man -l open  will give this output. 

open (9e)       -M /usr/man
open (n)        -M /usr/sfw/man
 

To search for the man pages in a particular path or if you want to override the MANPATH variable,use the -M option with the man command. For instance, to show the man pages for only the open(n) command from the previous example,type

$ man -M /usr/sfw/man open

Saving the man pages to a text file 

Here are two examples from the "man" man pages that show how to save the man pages to a text file.

$  man pipe.2 | col -x -b  >  pipe.text

And this one, also from the same man pages, creates a postscript version of the file.

$ env TCAT=/usr/lib/lp/postscript/dpost man -t -s 2 pipe > pipe.ps

Printing the man pages

The simplest way to do it is

$ man command-name | lp

For a more formatted output of the man pages, try this script (Thank you, Greg Price):

Create a file tcatscript.sh with the following contents and save it in the same directory as your .bashrc file:

#!/bin/sh

dpost < $1 | lp

Add this environment variable in your .bashrc file:

export TCAT=tcatscript 

Source the .bashrc file :

$ . ./.bashrc

Print the man pages

$ man -t command-name

There's more on man pages in this article by Ifeyinwa Okoye.

The Solaris man pages can be also be viewed online at http://docs.sun.com/app/docs/doc/816-5165.


Comments:

Hi Jyothi, Really excellent blog entries! Thanks so much for doing this, I'll link to you from the opensolaris doc community, so man new-to-solaris folks there need exactly this information as they get started. -Michelle

Posted by Michelle on March 26, 2007 at 11:18 AM PDT #

Hi Jyothi,

Im porting the code from linux platform to solaris,when i compile i get some undefined symbols (FD_SET,FD_ISSET n FD_ZERO) for which i m supposed to add the Link to LFLAGS in Makefile .even on adding -lsocket and -lnsl doesn't make any difference.

so do suggest the link that solves this problem.i m using 5.9 version.

thank's in advance
sharana
(sharana.patil@gmail.com)

Posted by sharana patil on January 15, 2008 at 03:27 AM PST #

Sharana,

Sorry for the delayed response.
Have you looked at the UNIX porting Guide at http://www.unixporting.com/quickguide.html?
Although it does not list Solaris 9, you might find something that will help you with your problem.
Try also, http://www.unixporting.com/porting-guides.html.

hth,
Jyothi

Posted by Jyothi Srinath on February 06, 2008 at 02:05 PM PST #

http://www.batterylaptoppower.com/toshiba/pa3536u-1brs-002.php 6.6ah New PA3536U Battery for Toshiba Satellite P200 P205 laptop battery ,
http://www.batterylaptoppower.com/toshiba/pa3062u-1bar.php New Genuine Toshiba Tecra 8200 Battery PA3062U-1BAR laptop battery ,
http://www.batterylaptoppower.com/toshiba/pa3209u-1brs.php Battery for Toshiba Satellite 1100 1110 PA3209U-1BRS laptop battery ,

Posted by laptop battery on November 05, 2008 at 07:49 PM PST #

Post a Comment:
Comments are closed for this entry.

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.