When you start a login shell, two system files /etc/csh.cshrc
and /etc/csh.login are read. These set up default shell and
environment variables and for example, display any current system news.
After this, if .cshrc and/or .login files exist
in your home directory, these are also run. These files set your own default
shell and environment variables and any other commands you wish to happen
on startup.
After logging into a system, you are in what is referred to as the login
shell. If you start another shell, for example a tcsh, by
typing tcsh, the .cshrc file will be read (if
it exists) and set shell variables for the current shell. The .login
file is not read again, however any environment variables set will be generally
inherited by the new shell. Therefore, commands such as startup messages
should be placed in the .login file and not in the .cshrc
file.
To change your default shell, for future startup, use the command chsh
and type in the filename of the shell you wish to change to. On some systems
there will be a file called /etc/shells which lists all available
shells and their locations.
.cshrc fileThis file is read by the C shell (.tcshrc will be used,
if it exists, by the tcsh) as if you had typed the commands yourself,
every time a shell is started. This is normally used for setting shell variables
and alias definitions. The .cshrc file is read before
the .login file.
.login fileThis file is executed when you login to the computer. The normal use
is for setting default environment variables and any startup commands. This
file is executed after the .cshrc file.
.logout fileThis file is executed when you explicitly logout from the computer.
This is normally used for parting messages and for starting processes
that are to run in the background after you have logged off. For example,
removing unwanted backup copies of files or displaying your file quota.
Make sure that the command works before adding it to the .logout
file.
Help: to see examples of .login
and .cshrc files.