Super User is a question and answer site for computer enthusiasts and power users. 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

On Unix I can call certain programs from everywhere, like sort, pwd or

How can I find out, where on the system really resides?

share|improve this question
up vote 2 down vote accepted

I would recommend using type command. which command only look in the PATH so can be misleading for builtins (like pwd), functions and aliases.

share|improve this answer
which actually also lists aliases. – Daniel Beck May 20 '11 at 10:40
I'm afraid it can't. which isn't a shell builtin so has no idea about internal commands/aliases and the like. – jlliagre May 20 '11 at 11:38
On my Linux box, "which" is unexpectedly aliased. Sorry about that. – Daniel Beck May 20 '11 at 12:38

Use which

which sort

Gives you (for example):


This also helps you to troubleshoot issues with your PATH, e.g. if you have several versions of the same binary installed and you don't know which one is called.

So if you have multiple versions, you can use the -a switch:

charon:~ werner$ which -a ruby
share|improve this answer
which will work for but will give misleading information about pwd and similar commands. – jlliagre May 20 '11 at 11:53

You must log in to answer this question.