The unset command can be used in order to completely erase the existence of an environment variable:
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
geditcommand from the terminal and
bash(the parent process) creates
gedit(the child process), the child process inherits all the environment variables and values the parent process had.
LANGenvironment variable in the terminal, and then run
geditfrom that same terminal,
geditwill inherit the new value of
LANG, and therefore may display in a different language than the rest of the processes on the desktop.
langis not the same variable as
laNg. It is a common practice to name all environment variables with only English capital letters and underscore
Session-wide environment variables
~/.profile. After having edited one of those files, you should re-login in order to initialize the variables.
FOOto a literal string and modifies the
FOO=barexample, quotes have not special meaning. This means that values cannot contain spaces.
PATH, which differs from the syntax of shell script files, is required for variable expansion to work. Some variables, like
HOME, might not be set at the time
~/.pam_environmentis parsed. See
/etc/security/pam_env.conffor more details.
~/.pam_environmentis written to when you use various GUIs to set the language or regional formats. Consequently, if you for instance set
~/.pam_environmentmanually, your entry will be overwritten if you afterwards use the Language Support GUI to change the regional formats setting.
DisplayManagerduring the start-up process desktop session as well as by the login shell when one logs in from the textual console. This is a
~/.profileequivalent of the above example:
export FOO=barexport PATH="$PATH:$HOME/MyPrograms"
System-wide environment variables
/etc/environment. An alternative is to create a file for the purpose in the
Note: Variable expansion does not work inFOO=bar
.shextension in the
/etc/profile.ddirectory get executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the
DisplayManagerwhen the desktop session loads.
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0export PATH=$PATH:$JAVA_HOME/bin