---
obj: concept
arch-wiki: https://wiki.archlinux.org/title/environment_variables
wiki: https://en.wikipedia.org/wiki/Environment_variable
---

# Environment Variables
An environment variable is a named object that contains data used by one or more applications. In simple terms, it is a variable with a name and a value. 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. They can be used in the [shell](../applications/cli/Shell.md) or by applications. For example containers in [docker](../tools/Docker.md) make heavy use of environment variables.

## Usage
List all environment variables currently set:
```
$ printenv
```

The env utility can be used to run a command under a modified environment. The following example will launch xterm with the environment variable EDITOR set to vim. This will not affect the global environment variable EDITOR.
```
$ env EDITOR=vim xterm
```

Environment variables can also be stored in `.env` files:
```shell
VAR=VALUE
PATH=$PATH:$HOME/bin
```

## Common environment variables
- `PATH`: PATH contains locations seperated by `:` where the system will look for commands
- `HOME`: The location of the users home directory
- `USER`: The username
- `LANG`, `LC_ALL`: The language used
- `SHELL`: The [shell](../applications/cli/Shell.md) of the user
- `TZ`: Timezone information
- `EDITOR`: The user's preferred editor
