The “which” Unix command lists the location of the first matching executable in your PATH. The GNU version of “which” has several extra features including the ability to display all matching executables in your PATH, not just the first. This is useful for finding duplicates, etc. Unfortunately, whatever version of “which” is included in Mac OS X (and MacPorts) doesn’t have these extra features.
A quick Google search didn’t turn up anything, and I was in a shell scripting mood when I needed it, so rather than downloading and compiling GNU which I whipped up my own, “multiwhich”:
Simply put this somewhere in your PATH with execute permissions, and type “which command“.
One other accidental “feature” of this script is the ability to list every executable in your PATH. This is great for finding duplicates:
It’s probably not the most elegant way to do it, but it serves it’s purpose. Perhaps someone will find it useful…
Update: I modified the multiwhich script slightly to support wildcards like “*” and “?”. You can now do things like “multiwhich x*” to get all binaries beginning with “x”, etc.