BashManaging PATH environment variable


Syntax

  • Add path : PATH=$PATH:/new/path
  • Add path : PATH=/new/path:$PATH

Parameters

ParameterDetails
PATHPath environment variable

Remarks

Bash configuration file:

This file is sourced whenever a new interactive Bash shell is started.

In GNU/Linux systems it's generally the ~/.bashrc file; in Mac it's ~/.bash_profile or ~/.profile

Export:

The PATH variable must be exported once (It's done by default). Once it is exported it will remain exported and any changes made to it will be applied immediately.

Apply changes:

To apply changes to a Bash configuration file, you must reload that file in a terminal (source /path/to/bash_config_file)