Linux environment variable is an object that contains value. In simple terms it is a pair of data object and their respective values. The value of an environmental variable can for example be the location of all executable files in the file system, the default editor that should be used, or the system locale settings. Following is the list of environmental variables along with their role:
- HOME: It contains the path to the home directory of the current user. This variable can be used by applications to associate configuration files and such like with the user running it.
- PWD: It contains the path to your working directory.
- OLDPWD: It contains the path to your previous working directory, that is, the value of PWD before last cd was executed.
- SHELL: It contains the path to the user's preferred shell. Note that this is not necessarily the shell that is currently running, although Bash sets this variable on startup.
- TERM: It contains the type of the running terminal, e.g. xterm-256color. It is used by programs running in the terminal that wish to use terminal-specific capabilities.
- PAGER: It contains command to run the program used to list the contents of files, e.g., /bin/less.