On a Bash Shell, one can set the path by using “export” command. Here is how to add a path.
export PATH=$PATH:/path/to/newdir
The above export command simply adds the new directory “/path/to/newdir” to existing list of search paths. One can check the current list of paths by typing
echo $PATH
By typing the above echo command before and after adding the path using “export” command, one can make sure if the desired new path is added to the list of paths.
Setting the PATH variable permanently
Typing the export command on the terminal will add the path temporarily just for the current session. And the path will not be in the search path once the session is over. For example, if you close the terminal, the path will be gone and you have to type the “export” command again.
A better solution that avoids tha hassle of typing evertime you open a terminal is to add the “export” command line to .bashrc. This will make the path to be automatically added in the search path as you open a terminal/login. The .bashrc file will be in the home directory and can be opened by text editor like vim/pico.