Environment Howto

(How to set up environment variables for the shell)

© (2004) Pablo Arés, pablo /at/ math.tifr.res.in


Some general comments and warnings

The shell is the way you interact with the operating system (and therefore the computer). It is the basic program that allows you to isse other commands to the computer. There are several types of shell, the most common ones are bash and tcsh. When you start a shell (usually after logging on in the system, or by opening an xterm in X-windows), some setting are done by the system, but you can change them. I explain below how to make those changes, but an important warning: if your set up is wrong you might not be able to execute programs or even log on in the system any more, so be careful with the changes you do. In case you run into serious trouble contact the system administrator for help.

Some of the things you can set up

Here is a (partial) list of environment variables, and a brief explanation of what they do, you can set up:


Know your shell and environment

To know which shell you are running, you can simply do

   ps
and see whether bash or tcsh comes up.
To know your logging shell (it might be different that the current shell if you did something that change it) to
   ypmatch my-logging-name passwd
and look at the end of the output. To find out your environment variables type either env or set

How to set up your environment in the bash shell

The system setting are in the file /etc/profile.

You can set up variables while working (and the setting will function only until you exit the session) or permanently (in the file .bash_profile or .bashrc). The following commands are for a working session; copy them in .bash_profile and .bashrc (to be sure that they work) for permanent changes. The lines below are examples, modify them according to your taste and needs.


How to set up your environment in the tcsh shell

The system files are /etc/csh.login and /etc/csh.cshrc Your own files are .tcshrc, .cshrc and .login
The commands for tcsh corresponding to the above ones are as follows: