.login
' Profile and `.cshrc
'As you probably remember from the first section, the outermost layer in the UNIX structure is the Shell, or command interpreter. The Shell, however, is simply a program called upon to interpret the commands users type, and as such, there are many different versions of the Shell. The two most widely used shells are the Bourne Shell (sh) and the C-Shell (csh). The shell that you will probably be using is tcsh, an improved version of the older csh (Use the ps command to determine which shell you are using). You can easily switch shells by typing in the name of the desired shell at the prompt (provided that your PATH has been suitably configured).
Besides several cosmetic changes, tcsh offers two important new features:
TAB
and tcsh
will complete the command or file name as much as possible, making it
much quicker to enter long names.
When you log in, your shell will execute a startup file known as
`.login
'. This file will contain specific commands that you would
always want to execute at the beginning of each login session (such as
checking for new messages). The `.login
' file that the new user
gets looks like this:
[lyman|9]
cat .logintset -I
if ( $?DISPLAY ) then
cat /etc/motd
endif
rn -c
To have the date and time echoed at login, just insert the command date; to set certain characters to special meanings use command stty (i.e. stty erase '^H' kill '^U').
Your `.cshrc
' is another initialization file that contains
directions that you want to be done for every shell (such as setting up
aliases for your favorite commands). The typical `.cshrc
' file is:
[lyman|10]
cat .cshrcsetenv EDITOR emacs
setenv PATH .:$HOME/bin:/usr/lang:/usr/ucb:/bin:/usr/bin:
/usr/local/bin:/usr/X11R6/bin:/usr/hosts:/usr/games
setenv MANPATH /usr/lang/man:/usr/man:/usr/local/man
setenv TEXINPUTS .:$HOME/tex:/usr/local/lib/tex/inputs//
setenv HOST `hostname`
set history = 40
set ignoreeof noclobber notify filec
if ( `basename $shell` == csh ) then
set prompt = "[$HOST|\!] "
else
set prompt = "[%M|%h] "
endif
unset autologout
umask 022
The PATH setting above is very important since it tells
the shell where to look for the programs that you enter as executable
commands. Note that the current directory . is searched first,
followed by your home `~/bin
', and finally various system
directories. To set an alias such as having bye mean logout,
simply insert alias bye 'logout'
in the file.