Datasheet
Task 1.8: Manage the Shell Environment
43
The PATH variable often includes the current directory indicator (.) so that pro-
grams in the current directory can be run. This practice poses a security risk,
though, because a miscreant could create a program with the name of some
other program (such as ls) and trick another user into running it by simply
leaving it in a directory the victim frequents. Even the root user may be vic-
timized in this way. For this reason, it’s best to omit the current directory from
the PATH variable, especially for the superuser. If it’s really needed for ordi-
nary users, put it at the end of the path.
$LD_LIBRARY_PATH A few programs use this environment variable to indicate directories
in which library files may be found. It works much like PATH.
$PS1 This is the default prompt in bash. It generally includes variables of
its own, such as \u (for the username), \h (for the hostname), and \W
(for the current working directory). This value is frequently set in
/etc/profile, but it is often overridden by users.
$TERM This variable is the name of the current terminal type. To move a
text-mode cursor and display text effects for programs like text-
mode editors, Linux has to know what commands the terminal sup-
ports. The $TERM environment variable specifies the terminal in use.
This information is combined with data from additional files to pro-
vide terminal-specific code information. $TERM is normally set auto-
matically at login, but in some cases you may need to change it.
$DISPLAY This variable identifies the display used by X. It’s usually :0.0, which
means the first (numbered from 0) display on the current computer.
When you use X in a networked environment, though, this value
may be preceded by the name of the computer at which you’re sit-
ting, as in machine4.example.com:0.0. This value is set automati-
cally when you log in, but you may change it if necessary. You can
run multiple X sessions on one computer, in which case each one
gets a different DISPLAY number—for instance, :0.0 for the first ses-
sion and :1.0 for the second.
$EDITOR Some programs launch the program pointed to by this environment
variable when they need to call a text editor for you to use. Thus,
changing this variable to your favorite editor can help you work in
Linux. It’s best to set this variable to a text-mode editor, though; GUI
editors might cause problems if they’re called from a program that
was launched from a text-mode login.
TABLE 1.5 Common Environment Variables and Their Meanings (continued)
Variable Name Explanation
83484.book Page 43 Monday, September 18, 2006 8:58 AM










