The export command is used to make available variables and associated values for other programs called after the export command. When this happens the variable is called an environment variable.

Create New

For example, to make available to following programs the variable myVar, with a value of 5, you would do the following:

To verify the variable exists, you can then type  echo $MY_VAR. Note: You cannot put a space before or after the equals sign!

Append To

You can append to environment variables. This is useful, for example, when adding more directories to the $PATH variable. You could append a directory to the $PATH variable using the export command in the following manner:

 Permanent Environment Variables

To make variables permanentely available you can put export commands in the ~/.bash_profile file.

See Current Variables

To see a list of all currently exported variables and functions, use the command:

Some standard environment variables include:


Posted: January 3rd, 2014 at 9:06 pm
Last Updated on: April 27th, 2017 at 4:40 am