NERSC logo National Energy Research Scientific Computing Center
  A DOE Office of Science User Facility
  at Lawrence Berkeley National Laboratory
 

Shells and Startup Files


Contents

PDSF Defined Environment

User Modifications to Environment

Troubleshooting and Cautions


PDSF Defined Environment

When new users are added to the PDSF machines, the shell is set according to a request. One can choose between tcsh (an enhanced version of the C shell), ksh or bash. A default user home directory is created under the name,

    /u/login-name

PDSF has adopted the modules package as the method of specifying the user environment to access different versions of compilers, libraries, man pages, etc. For this reason it is very important that users avoid redefining paths and environment variables as is the practice with some other UNIX machines. Please see the introductory page on modules.

C Shell Family Login Environment

With the C shells (csh and tcsh), when a login shell is opened commands are read first from .cshrc in the users home directory. On pdsf the default version of .cshrc does the following:

     sources /u/startup/pdsf.cshrc
     for a new window augments PATH and MANPATH
     for a new window loads several modules
     for an interactive shell sets aliases and local variables
     including the prompt

The file /u/startup/pdsf.cshrc does several things:

     initializes the modules package
     for a new window sets PATH, MANPATH and MODULEPATH
     sets umask, the default file protection
     this script may also run other group related setup
     scripts
     also grid related setup is done here

After execution of .cshrc the .login file in the users home directory is then executed. On pdsf the default version of .login does the following:

     sources /u/startup/pdsf.login
     set environment variables such as a default printer

The file /u/startup/pdsf.login does several things:

     set some common terminal characteristics
     print the message of the day
     notify the users if they have mail
     notify the users if there is new news
     make a "best try" to set the DISPLAY

Users are welcome to customize their .cshrc and .login files. The files pdsf.cshrc and pdsf.login are not designed to require individual customization.

Bourne Shell Family Login Environment

With the Bourne shells (sh and ksh), when a login shell is opened commands are read first from .profile in the users home directory. On pdsf the default version of .profile does the following:

     sources /u/startup/pdsf.profile
     sets ENV to be ${HOME}/.kshrc and exports it
     augments PATH and MANPATH
     loads several modules
     sets some variables including the prompt

The file /u/startup/pdsf.profile does several things:

     initializes the modules package
     sets PATH, MANPATH and MODULEPATH
     sets umask, the default file protection
     set some common terminal characteristics
     print the message of the day
     notify the users if they have mail
     notify the users if there is new news
     make a "best try" to set the DISPLAY
     also runs any group related setup

After execution of .profile for ksh and POSIX shells (but not for the Bourne shell) the file specified by the ENV variable (usually .kshrc) is executed. On pdsf the default version of .kshrc does the following:

     sources /u/startup/user.kshrc if it exists
     set a few flags including the type of command line editing
     defines aliases

The file /u/startup/user.kshrc does not exist at present. It is reserved for future expansion.

Users are welcome to customize their .profile and .kshrc files. The files pdsf.profile is not designed to require individual customization.

Back to Top


User Modifications to Environment

On some other UNIX systems users could freely modify their startup files to accomodate their particular preferences of PATH, MANPATH, LIBPATH, etc. However, with the use of modules much of the environment is now controlled by the system. In order to avoid confusion between system and user modifications to the environment variables, users should alway make changes by way of augmentation rather than redefinition of the PATH, etc.

For example, in the ~/.cshrc file, add your directories to the path as follows:

   set path = ($path /project1/bin /project2/bin)

For users of a POSIX shell, the way to modify a path in the ~/.profile file is:

   PATH=$PATH:/project1/bin:/project2/bin

Back to Top


Troubleshooting and Cautions

Please do not copy startup files from other machines

Users should never copy startup files from other machines. This will cause much confusion. Users may add their favorite customizations (alias, etc.) to the startup files and then check for any conflicts with the default environment.

If your startup files got overly complicated and confusing and you want to start over you can copy versions that are given to new users from

/u/startup
.cshrcfromuser.cshrc
.kshrcfromuser.kshrc
.loginfromuser.login
.profilefromuser.profile

Caution when customizing the environment

Users are encouraged to become familiar with the default, system-defined environment before making customizations.

Users should be sure that their customizations do not conflict with system defined environment variables and aliases. If you find that something is "missing" in your envinronment, first remove your customizations and see if they are causing a conflict with the system-defined environment.

Caution when modifying path

Users should never redefine their path; rather additional directories should be prepended or appended to the existing path. Most path modifications should be done by modules rather than directly by the user.

Commands such as:

   set path = (dir1 dir2 ...)
   setenv LD_LIBRARY_PATH dir1:dir2 ...

are an invitation to disaster.

Back to Top


LBNL Home
Page last modified: Tue, 01 Jun 2004 22:17:14 GMT
Page URL: http://www.nersc.gov/nusers/systems/PDSF/starting/files.php
Web contact: webmaster@nersc.gov
Computing questions: consult@nersc.gov

Privacy and Security Notice
DOE Office of Science