Add new path to system paths

In Windows or Linux/Unix, there exist a special environment variable named "PATH" to list the command line search paths (multiple paths are separated by ";" in Windows and ":" in Linux/Unix). When you type a command without a full path from a terminal/command window, the operating system (shell, to be more accurate) will search all paths in your PATH variable and execute the first executable it finds.

Add path in Windows

To add a new path to Windows's PATH variable, you can right click on "My Computer", select "Properties", then click "Advanced" Tab, click "Environment Variables", you will see a dialog, the upper part is for per-user settings, and lower part is for system settings. Find a variable named "PATH", double click, then navigate to the end of the "Variable values" field, then type ";" followed by the path you want to add. Then click OK, and two more "OK"s to close the setting windows. From now on, any new command window (cmd) or new program will see the updated PATH settings.

Add path in GNU/Linux

You first need to determined which shell you are using, most people use bash or tcsh. You can find out by typing "echo $SHELL" from a terminal. If you are using bash, then open your bash profile with your favorite editor (vi, emacs, nano, nedit etc), for example
 nano ~/.bashrc
at the end of the file, add
 export PATH=/path/to/add:"${PATH}"
If you are using tcsh, you can do this by
 nano ~/.cshrc
and add
 setenv PATH "/path/to/add/:$PATH"
Save your file, quit the editor, and start a new terminal, then type "echo $PATH" and see if your new path is added.
Powered by Habitat