Important Environment Variables

Some Important Variables

These variables are important for all shells, unless noted otherwise.


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 where node is your machine name.


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.


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.


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.


The MANPATH variable lists the set of directories that the shell looks in to find man pages.


This variable is set to your default shell. Your default shell is determined by the last field in your password file (/etc/passwd) entry.


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.


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.