In an UNIX environment (and even in other systems like DOS, Windows, etc) there are directories where the shell looks for executables. In an Unix environment it's defined in the PATH
variable. You can see the directories in the PATH
variable executing the following command:
$ echo $PATH
The result will be something like:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
As you can see, the variable is a list of directories separated by a colon. When you run a command, e.g. ls
, the system will search for an executable in the first directory of the list (in the example, /usr/local/sbin
). If it doesn't find a file named ls
there, it will try the next directory, until it finds it. So if your ls
command is located on /usr/bin
, it will execute. Or, you'll get a command not found error if the shell cannot find it anywhere.
However, there are other ways to call an executable. Imagine you have two programs named ls
in two directories in the PATH
, and you want to run the second one. The way of doing that might be running /usr/bin/ls
, so you specify which one you want.
The .
is a shortcut for the current directory. So if you're at /home/user
, ./configure
is a shortcut for /home/user/configure
.
You can remove a file from the PATH
by looking for the place it's located and removing it. However, you might prefer to manage binaries installed into your system through a package manager, available in most modern distributions (like rpm, dpkg, pacman, etc). If the Makefile creates several executables, it's going to be easier to remove them this way (also, the makefile might create some library files and several other things, that's why it's easier to use a package management tool). Sometimes a Makefile might bring an uninstall routine (i.e. make uninstall), but I'm not sure how often it happens. If you are updating a program through a new makefile, a new make install
would likely replace the old binaries, but there's no guarantee of that.
You can always find out what is the executable for a certain command by running which
. For instance, if you want to know where ls
is:
$ which ls
/usr/bin/ls