Environment Variables in Ubuntu

1. To print the names and values of all currently defined environment variables:


2. To examine the value of a particular variable, we can specify its name to the printenv command:

printenv TERM


echo $TERM

3. Erasing environment variables

The unset command can be used in order to completely erase the existence of an environment variable:

unset LC_ALL

It is also possible to use the "-n" switch to the export command in order to un-export an environment variable and therefore demote it to become a shell variable while preserving its value.

export -n LC_ALL

4. Working principles of environment variables

Process locality


Case sensitivity

5. Persistent environment variables

Session-wide environment variables

System-wide environment variables