List of Environment Variables in Linux/Unix
โก Smart Summary
Environment variables in Linux and Unix are dynamic named values that shape how programs and the shell behave, storing settings such as your PATH, home directory, default editor, language, and the shell currently in use.

Environment variables are one of the first things worth understanding on any Linux or Unix system, because they quietly control how your programs and shell behave. This guide explains what they are, the most common ones, and how to read, create, and delete them.
What is a Computing Environment?
The computing environment is the platform (platform = operating system + processor) where a user can run programs.
What is a Variable?
In computer science, a variable is a location for storing a value, which can be a filename, text, number, or any other data. It is usually referred to by its symbolic name, which is given to it at creation. The value stored can then be displayed, deleted, edited, and re-saved.
Variables play an important role in computer programming because they enable programmers to write flexible programs. Because they are tied to the operating system you work on, it is important to know some of them and how you can influence them.
What are Environment variables?
Environment variables are dynamic values that affect the processes or programs on a computer. They exist in every operating system, but the types may vary. Environment variables can be created, edited, saved, and deleted, and they give information about the system behavior.
Environment variables can change the way software and programs behave. For example, the $LANG environment variable stores the language that the user understands. This value is read by an application so that a Chinese user is shown a Mandarin interface while an American user is shown an English interface.
Let us study some common environment variables:
| Variable | Description |
|---|---|
| PATH | This variable contains a colon (:)-separated list of directories in which your system looks for executable files. When you enter a command in the terminal, the shell looks for the command in the directories listed in the $PATH variable. If the command is found, it executes. Otherwise, it returns with an error ‘command not found’. |
| USER | The username |
| HOME | Default path to the user’s home directory |
| EDITOR | Path to the program that edits the content of files |
| UID | User’s unique ID |
| TERM | Default terminal emulator |
| SHELL | Shell being used by the user |
Accessing Variable values
To determine the value of a variable, use the echo command:
echo $VARIABLE
For example, the screenshot below shows the value of the PATH variable displayed with the echo command.
Any environment variable can be read the same way. The output below shows echo returning the value of a variable.
Variables are case-sensitive, so make sure you type the variable name in the correct letter case; otherwise you may not get the desired result. To list every environment variable at once, use the env command, as shown below.
Set New Environment Variables
You can create your own user-defined variable with this syntax:
VARIABLE_NAME=variable_value
Again, remember that variable names are case-sensitive and are usually written in uppercase. A variable created this way is a local shell variable that only the current shell can see. To promote it to an environment variable that child processes also inherit, use the export command:
export VARIABLE_NAME=value
The screenshot below shows a new variable being created and then displayed with echo.
Deleting Variables
The following syntax removes a variable from the system:
unset variablename
This removes the variable and its value from the current shell session, as shown below.




