Environment Variables

Unix commands and other programs have many options. Some options are controlled by configuration files, others by command-line switches, and still others by environment variables. Each environment variable has a name and a bit of text (usually one line's worth) associated with it. You are free to examine environment variables and change them.

To Examine one Environment Variable

(~) 66% echo $DISPLAY
formaggio.cshl.org:0.0

To Change the Value of an Environment Variable

(~) 67% setenv DISPLAY pc505.cshl.org:0.0

To Delete an Environment Variable

(~) 68% unsetenv DISPLAY

To Print Out All Environment Variable

(~) 69% printenv
PWD=/home/lstein
ORGANIZATION=Cold Spring Harbor Laboratory
EDITOR=xemacs -nw
REPLYTO=lstein@cshl.org
LD_LIBRARY_PATH=/home/lstein/lib
CLASSPATH=/usr/local/java/lib/xp.jar:/usr/local/java/lib/jsdk.jar:/home/lstein/lib:.
CVS_SERVER=cvs -T /usr/tmp
CVS_RSH=ssh
CVSROOT=/usr/local/cvs_repository
RSYNC_RSH=ssh
PRINTER=lp
HOST=pesto.capricorn.com
GROUP=lstein
VENDOR=intel
PATH=/home/lstein/bin:/usr/local/bin:/usr/X11/bin:/usr/bin:/bin:/usr/local/games:/usr/local/java/bin:/usr/local/applix:/usr/local/apache/bin:/usr/local/samba/bin:.
HOME=/home/lstein
OSTYPE=linux
HOSTTYPE=i586-linux
USERNAME=
SHELL=/bin/tcsh
MINICOM=-c on
LOGNAME=lstein
MACHTYPE=i586
USER=lstein
LESS=-MXen
ENV=/home/lstein/.bashrc
LESSOPEN=|lesspipe.sh %s
MANPATH=/usr/local/lib/perl5/man:/usr/local/man:/usr/man:/usr/X11/man:/usr/openwin/man:/usr/local/samba/man
LS_OPTIONS=--8bit --color=tty -F -b -T 0
ignoreeof=10
HOSTNAME=formaggio.capricorn.com

Important Environment Variables

The following environment variables contain important and/or useful information:

PATH
A colon-delimited list of directories that the shell will search through when you type a command.
TERM
The current terminal type, which in term controls whether the screen can do colors, scrolling, etc.
DISPLAY
The machine on which X-windows based applications will display their windows. Usually of the form: hostname:0.0, where hostname is the name or IP address of your computer. (Don't worry about the meaning of the 0.0 -- it's "nothing")
HOME
Path to your home directory.
USER
Your user name.
<< Previous
Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Thu Sep 16 15:54:09 EDT 1999