How to list installed versions of the same program

I have a program called PyMOL installed multiple times on my machine. One was installed by MacPorts, one was installed through the developers distribution channel and so on. One is in /opt/local/bin, the other is in /i/have/no/clue.

I know I can use "which pymol" to see, where the one that is executed is located, but how can I get the location of the other ones with the same name?


You have the right command and just need to set the proper option:

which -a pymol will show all instances of the executable pymol located within your PATH.

For example, on my laptop I have git installed in two places:

$ which git
/usr/local/bin/git

provides what will be run when I use the command git.

$ which -a git
/usr/local/bin/git
/usr/bin/git

provides every instance of the executable in my PATH.


whereis pymol should show you all matches that are in your executable path.


You could use "find" or "locate" and then run the results through "grep".

This will give you more than the results of "which" or "whereis" which will only show things on $PATH.

"locate" is faster, but uses an index which isn't always up-to-date.

"find" is slower, doing a recursive search of everything, but it produces all results -- not just the results that have been indexed like "locate" does.