3. Environment Variables

3.1. Environment Variable Values

Many environment variables on an HPC cluster are preset for you by the system administrator. Examples include:

  • PATH - a list of directory paths to search for executable files when you type a command without providing the full path.
  • HOME - the location of your home directory.
  • SHELL - the full filename of your default shell.
  • HOSTNAME - the hostname assigned to the resource.

You can find the value of any of these variables using the Unix echo command. For example, to find the value of the PATH environment variable, you would enter the command 'echo $PATH.'

Below is a sample session using the echo command to display the values of the PATH and HOME environment variables.

output from echo $path command     

Figure: Using the echo command to display individual environment variable values.

You can display the values of all of your environment variables using the Unix env command with no command options. A sample session using the env command is shown below. The output has been truncated to save space.

Output from env command     

Figure: Using the env command to display all environment variable values.

The sample output above shows that the variables are listed as keyword/value pairs separated by an equal (=) sign. For example, SHELL=/bin/bash means that the environment variable's value SHELL is /bin/bash.