Environment variables are variables that contain values necessary to set up a shell environment. Contrary to shell variables, environment variables persist in the shell’s child processes.
```console
VARIABLE_NAME=value
```
Most Common Environment Variables:
- PWD – Current working directory.
- HOME – The user’s home directory location.
- SHELL – Current shell (bash, zsh, etc.).
- LOGNAME – Name of the user.
- UID – User’s unique identifier.
- HOSTNAME – Device’s hostname on the network.
- MAIL – User’s mail directory.
- EDITOR – The Linux system default text editor.
- TEMP – Directory location for temporary files.
How to Check Environment Variables:
Structurally, environment and shell variables are the same – both are a key-value pair, separated by an equal sign.
-`printenv`. Prints the values of all or some environment variables.
```console
$ printenv HOME
/home/user
```
Search Specific Environment Variables:
To find all the variables containing a certain character or pattern, use the `grep` command: