This is an old revision of the document!
I'm not sure how one first gets exposed to path variables, only that it can be confusing at first glance. This document tries to remedy that without going into the history of everything.
What you need to know:
There are various directories that follow this pattern [not limited to]:
bin: binaries (actual commands you execute: e.g.
include: source code
share: other, usually documentation
man: manual pages
The directories can exist inside of any directory path. There are the usual ones you may have seen already:
If you are aiming to use (command-line) programs that are not within one of these canonical
bin directories, then you should edit the
PATH environment variable in your shell. The
PATH variable is a list of directories, delimited by
: colons, in which the shell will look in, in order, when you type a command name at the shell prompt. For example, when you type
ls to list the contents of the current working directory, the shell is running
ls because it found the
ls program in your
PATH. You can run
which ls to see that your shell is (likely) running the
/bin/ls executable, and you can run
echo $PATH to see that
/bin is in your path.
To add new directories to your path, you need to add them to
$PATH. Assuming that the command-line programs you want to use do not have the same name as programs in the canonical location, it is best to add new directories to the end of the path. You can do this with:
/new/path/to/add is the directory containing the programs you want to run.
… FINISH: can do this per-shell, but then doesn't persist to other login shells
… thus, have to add setting
PATH to what? file