Working with environment variables - muhamed-hassan/safe_planet GitHub Wiki

Add new environment variable:

  • update configurations file environment
  • add new environment variable in the form of "KEY=VALUE"
  • reload the environment using source
sudo nano /etc/environment
ENVIRONMENT_VARIABLE_KEY=ENVIRONMENT_VARIABLE_VALUE
source /etc/environment

Print all environment variables

printenv

Remove the added environment variable by key

unset ENVIRONMENT_VARIABLE_KEY

Updating the PATH built-in environment variable by adding a directory of executables to it, so later they can be invoked from the terminal:

  • update configurations file profile
  • update PATH environment variable
  • reload the environment using source
sudo nano /etc/profile
export PATH=$PATH:<PATH_TO_THE_DIRECTORY_OF_EXECUTABLES>
source /etc/profile