Glossary

export

export is a shell builtin that marks a variable so it is included in the environment of subsequently-executed commands. Without export, a variable exists only in the current shell.

FOO=bar                  # shell-local
export FOO               # now inherited by children
export FOO=bar           # assign and export in one step
export -n FOO            # remove the export attribute
export -p                # list all exported variables

Typical uses: setting PATH, EDITOR, language-specific variables like PYTHONPATH or JAVA_HOME, and application-specific configuration. A login file like ~/.profile or ~/.bash_profile is the usual home for export statements that should apply to every interactive session.

Related terms: env, Shell, Environment Variable

Discussed in:

Textbook of Linux — Learn Linux on iPhone — Download on the App Store