Bash Managing PATH environment variable

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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)



Got any Bash Question?