You and your MANPATH

What is your MANPATH?

No, it is not your machismo destiny! To see your current MANPATH, type

echo $MANPATH

You will see a list of UNIX directory names separated by colons. This is where UNIX looks for the man pages that come up when you type man "command_name."

The MANPATH is an environment variable that should be set by the system in a file called

/usr/share/standard/sys.login

that is called from your personal .login file. (Your personal .login file is in your home directory.)

You will want to add some lines to your personal .login file (or .cshrc) file to make sure that your MANPATH is set properly. For example,

setenv MANPATH /usr/local/X11/man:/usr/local/man:/usr/lang/man:/usr/man

is enough for most people.

However, if you add certain packages to your path and if you log on to both sunos and solaris machines at various times, you will want to add a "switch" command to your .login (or .cshrc) file so that your MANPATH is set correctly depending on what kind of machine you are on. The following sequence of lines works nicely:


switch (`uname -r`)       # those are backquotes around uname -r
      case 5*:
        set system=solaris
        breaksw
      default:
        set system=sunos
        breaksw
endsw

switch ($system)
   case sunos:
      set tempmanpath = ( /usr/man /usr/*/man /usr/local/*/man/ )
      set manpath=`echo $tempmanpath | sed 's/ /:/g'`
      setenv MANPATH $manpath
   breaksw

   case solaris:
      set tempmanpath = ( /usr/man /usr/*/man /usr/local/*/man/ /opt/*/man )
      set manpath=`echo $tempmanpath | sed 's/ /:/g'`
      setenv MANPATH $manpath
   breaksw

endsw


If you don't want to risk botching up your .cshrc file, click HERE, fill out the form, follow the simple instructions, then click on SUBMIT at the bottom of the form. A sample .cshrc file will be displayed that you can download and install (or you can just study it as an example). The problem of expanding your $MANPATH variable is handled as it is above.

More info about the MANPATH is available at: