Never confuse education with intelligence, you can have a PhD and still be an idiot.
- Richard Feynman -



PATH

From Juneday education
Jump to: navigation, search

PATH is an environment variable, available on most platforms. It contains a list of directories to search for executable programs invoked on the command line. Trying to invoke a program or command from the command line and getting "Command not found", is an indication that your PATH variable doesn't contain the path to the command in question.

Adding a directory to your PATH

Windows

Open Settings:

  • Search for "environment variable" and choose "Edit the system environment variables"
  • Click "Environment variables"
  • In the new window ("Environment variables") mark the row "Path" in the lower part of the window (see picture below) and click "Edit"
  • Press "New" and fill in the PATH you wish to add to your PATH variable. In the picture below we've added C:\ Program Files\gedit\bin which is the directory where the Gedit editor is installed.
  • Click OK

Note: if you'reusing cygwin the changes in PATH will have effect when cygwin is started. This means that you may have to restart cygwin

Win-path-edit.png Win-path-add.png


Read more about the PATH variable on wikipedia .

MacOS and GNU/Linux

Open up the file ~/.bashrc and add the following line at the end of the file

PATH=${PATH}:/new/dir/to/add

The example above will add the directory /new/dir/to/add to your PATH. The change will occur next time you start bash.

Note: there are other better ways of doing this but this will work on both MacOS and GNU/Linux and requires no logout/login.