User environment configuration 5–3
Explanation Linux saves various configuration values in memory for each user on the system. There
are two types of such variables: shell variables and environment variables. Shell
variables are values that exist for a single instance of a shell. Environment variables are
accessible to the shell in which they were set as well as to any child processes and
Shell and environment variables are essentially identical. They differ only in where they
are accessible. For that reason, unless we need to describe one type explicitly, we
simply call them all variables.
Variables store information needed by the operating system and applications to locate
files, determine which shell to use, what language output to use, and so forth. By
convention, variables are named in all uppercase. You can create your own user-defined
variables. Those too are, by convention, in all caps. The following table lists some of
the standard BASH variables.
BASH Full path to the BASH shell executable.
The absolute path of text editor programs, such as vi.
ENV Path to the BASH runtime configuration utility (typically ~/.bashrc).
EUID The effective user ID of the logged-in user.
HISTFILE The path to the history file.
HISTFILESIZE The number of commands to be stored in the history.
HOME The absolute path to the user’s home directory.
HOSTNAME The host name of the computer.
LOGNAME The current user’s login name.
MAIL The absolute path to the user’s mail file.
The absolute path of the default programs, such as
less or more,
through which files are output for paged display.
PATH A list of directories to search for executables when users enter
commands without absolute or relative path names.
PRINTER The name of the default printer.
PS1 The prompt for the primary shell.
PS2 The prompt for the secondary shell.
PWD and OLDPWD The current and previous working directories, respectively.
TERM and TERMCAP Variables used on older systems to identify the console (non-GUI
terminal) and its settings. TERM is usually set to “linux” on new
systems and “console” on older systems.