-->
Previous | Table of Contents | Next |
Weve shown many ways of customizing tcsh in this chapter. If you simply enter the commands that we have discussed at the command line, the changes you make will be lost every time you log out of the system. This section describes how to store these changes in a file that are executed each time you start tcsh.
Tip:
If you make even a small mistake editing the tcshfiles, you can cause problems when logging in. For this reason, make safety backup copies before you edit and verify each of your edits carefully before you save the new file.
Two initialization files are important to tcsh. The first is called the login file. The commands in this file are executed when you first log in to Linux. The contents of the default login file are as follows:
if ($?prompt) then #this means that the shell is interactive umask 022 set cdpath = ( /usr/spool ) set notify set history = 100 set histfile = .history # The savehist variable is set to tell tcsh to # save the history list to the history file on # logout. The value of 25 means that tcsh will # save the last 25 commands to the history file. set savehist = 25 setenv OPENWINHOME /usr/openwin setenv MANPATH /usr/local/man:/usr/man/preformat:/usr/man:/usr/X11/man: /usr/openwin/man setenv MINICOM -c on setenv HOSTNAME cat /etc/HOSTNAME set path = ( $path /usr/X11/bin /usr/andrew/bin $OPENWINHOME/bin /usr/games . ) endif # I had problems with the Backspace key installed by tset, but you might want # to try it anyway, instead of the setenv term .. below it. # eval tset -sQ $term # setenv term console if ! $?TERM setenv TERM console set prompt = %m:%~%# alias ls ls -F if ( { tty --silent } ) then >& /dev/null echo ;fortune;echo endif
This file, csh.login, can be found in the /etc directory. If you want to change any of the settings found in csh.login, copy it to your home directory and make the changes you want there.
The other file that tcsh makes use of is cshrc. The commands in this file are executed each time a copy of the tcsh program is run. Examples of the types of commands that usually appear in this file are aliases and variable declarations. This file, csh.cshrc, is also contained in the /etc directory. If you want to make changes to this file, copy it to your home directory and make your changes there.
When you first log in to Linux, tcsh executes the /etc/csh.cshrc file, followed by the /etc/csh.login file. It then checks your home directory to see if you have a personal copy of the csh.cshrc file. This file can be named either .tcshrc or .cshrc. If you have one of these files in your home directory, tcsh executes it next.
tcsh then checks to see if you have your own copy of the csh.login file in your home directory. This file must be named .login. If you do have a .login file in your home directory, it is executed next.Whenever you start another copy of tcsh after you log in to the system, it executes the commands that are in the /etc/csh.cshrc file and then checks your home directory to see if there is a .tcshrc or a .cshrc file there.
Here are some of the most useful tcsh commands:
Here are some of the most useful tcsh variables:
The last three chapters have presented the fundamental commands and concepts of the three most popular UNIX shells. tcsh is the most feature-rich shell of those presented but that doesnt necessarily mean that its the best shell for you to use. In the end, this decision will probably be based on your personal preference as opposed to what features are offered.
The next chapter looks at the programming languages that are provided by each of the shells we have discussed. You may want to learn about other subjects before of moving on to the C shell. To learn about:
Previous | Table of Contents | Next |