Using Environment Variables

A number of in-memory variables are assigned and loaded by default when the user logs in. These variables are known as shell environment variables, which can be used by various commands to get information about your environment, such as the type of system you are running, your home directory, and the shell in use. Environment variables are used by Linux operating systems to help tailor the computing environment of your system, and include helpful specifications and setup, such as default locations of executable files and software libraries. If you begin writing shell scripts, you might use environment variables in your scripts. Until then, you only need to be aware of what environment variables are and do.

The following list includes a number of environment variables, along with descriptions of how the shell uses them:

• pwd To provide the name of the current working directory, used by the pwd command (such as

/home/andrew/foo)

• user To declare the user's name, such as andrew

• lang To set language defaults, such as English

• shell To declare the name and location of the current shell, such as /bin/bash

• path To set the default location of executable files, such as /bin, /usr/bin, and so on

• ld_library_path To declare the location of important software libraries (because most, but not all, Linux commands use shared resources)

• term To set the type of terminal in use, such as vt100, which can be important when using screen-oriented programs, such as text editors

• machine To declare system type, system architecture, and so on

Was this article helpful?

0 0

Post a comment