This post I will highlight 3 ways to change to your PATH variable.
1. The quick way
Firstly, check your current PATH
If the directory (eg. /my/new/path/) you want to add is not already in your current PATH, then you can easily add with the command
It’s not really done, if you would like the PATH to change permanently (which is usually the case). This quick method only change the PATH for that bash session. If you close the terminal or open a new terminal, the PATH reverts back.
2. Set permanently for a user
This brings us to the second way of setting PATH permanently for a user.
Edit the user’s bash profile (replace USERNAME)
Insert (or edit) this line
Press ctrl-x, then ctrl-y, to save the file.
3. Set for all users
As a bonus, if you want the PATH to change for all users
sudo pico /etc/paths
Enter your superuser password to edit, and insert or edit this link
That’s it! Enjoy your path!