changing an environment variable like PATH forever
make the setting persistent:
add this line: export PATH=/path/to/dir in your ~/.bashrc if using bash, or ~/.zshrc for zsh:
$ vim ~/.bashrc
export PATH=$PATH:/path/to/dir
:wq
or:
$ echo "export PATH=$PATH:/path/to/dir" >> ~/.bashrc
LATER EDIT!
Each time you execute a bash (non-login) shell instance, it reads and executes the .bashrc
file in your home directory. Login shells, on the other hand, do that for .profile
file, located in your home directory. You can find the difference between login and non-login shells by reading the bash manual.
In your case, open your ~/.bashrc
and set there the variable that you want. For example:
PATH="/some/new/path:$PATH"
Save it, and reload it:
$ source ~/.bashrc