Environment Variables

Before Starting

Consider these important facts:

Initializing Your Environment

When a bash session starts, it reads commands from ~/.bash_profile.

Environment variables are set in the file ~/.bashrc.

📝 Note: The files ~/.bash_profile and .bashrc are hidden. To list hidden files, type ls -a.

Know the Environment Variables

Here is a list of some common environment variables:

📝 Note: See the values of all your environment variables by typing env on your terminal.

Working with Environment Variables

  echo $HOME
  export PATH=$PATH:/home/UID
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/UID/custom_lib_directory
  export OMP_NUM_THREADS=12

This command sets the value of the variable called OMP_NUM_THREADS (an OpenMP parameter) to 12.