Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to use which on an aliased command?

I'm used to working on systems where which would list aliases, so e.g. if I have an alias like this:

alias foo=/path/to/executable

Then I get meaningful output from which foo. (From memory it's something like alias: /path/to/executable).

On my Macbook Pro (Snow Leopard) this doesn't work. I seem to recall it's non-standard and needs an alias of its own (on which) to work, but I've forgotten the details. Can anyone point me in the right direction please?

(I'm a bash man if that makes any difference to your answer.)

share|improve this question

marked as duplicate by Gilles, Michael Mrozek Jun 6 '11 at 22:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I would use type instead of which, because which is unreliable (as you noticed; unless it's a shell builtin, it has to guess at your environment).

share|improve this answer
Thanks, hadn't come across type before. There's a lot of muscle memory for me to overcome in order to wean off which though. :) – Simon Whitaker Apr 5 '11 at 21:03
alias which type? – geekosaur Apr 5 '11 at 21:05
I like alias where='type -a' – glenn jackman Apr 5 '11 at 21:55
I do the same as glenn, but mine is: alias witch='type -a', and just to play it safe for forgetful me: alias which=witch – bev Apr 6 '11 at 20:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.