Important Environment Variables
Some Important Variables
These variables are important for all shells, unless noted otherwise.
DISPLAY
In order to use an X windows application, the environment variable
DISPLAY must be set correctly. Usually, this variable is set when you
login if X11 forwarding is enabled by your SSH program. Its value is of the
form node:screen.server. On the A&M campus, this will generally
look like node.tamu.edu:0.0 where node is your
machine name.
HOME
Your home directory is the top of your personal branch in the file system, and is usually designated
by your username, i.e. /{path}/{username}. The value of the variable HOME is
the pathname of your home directory. The command cd without arguments always
returns you to $HOME. In all shells except sh, the tilde (~) symbol
used in filename expansion, expands to the value of this variable. For example ~/myfile
is equivalent to $HOME/myfile. Also, ~{username} is equivalent to the
$HOME directory of user username.
PATH
The PATH variable lists the set of directories that the shell looks in to find the commands that you enter on the command line. (For the C shell family, the shell variable path takes its value from PATH.) If the path is set incorrectly, some commands may not be found. If you enter a command with a relative or absolute pathname, the shell will only search that pathname for it, and not refer to PATH.
If you include the current working directory, "dot" (.), in your PATH, the
shell will always find your current working directory. This allows you to run executable files from your
current working directory by typing in only the filename.
For the C shell family, this would be done as follows:
set path = ($path .)
For the Bourne shell family, as follows:
PATH = ${PATH}.:
If "dot" is not in your PATH, then in order to execute a file, you need to precede the
executable filename by ./ on the command line. This provides the current directory
pathname explicitly.
LINES and COLUMNS
These variables control the number of lines and columns are displayed on your screen. The csh family syntax is:
% setenv LINES n % setenv COLUMNS n
to set the number of lines or columns to n.
MANPATH
The MANPATH variable lists the set of directories that the shell looks in to find man pages.
SHELL
This variable is set to your default shell. Your default shell is determined by the last field in your
password file (/etc/passwd) entry.
ignoreeof
This shell variable is in csh, tcsh, ksh and bash. sh
doesn't have it. When the ignoreeof variable is set, you cannot exit from the shell using
<Ctrl-d>, so you cannot accidentally log out. You must use
exit or logout to leave a shell.
noclobber
This shell variable is in csh, tcsh, ksh and bash. sh doesn't have it. With the noclobber variable set, you are prevented from accidentally overwriting a file when you redirect output. It also prevents you from creating a file when you attempt to append output to a nonexistent file.
noclobber has no effect on utilities such as cp and mv. It is only useful for redirection.