Server Fault is a question and answer site for system and network administrators. 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

Is there a command I can use to easily find the path to an executable? I'm looking for identify on my local machine - something like pwd?

pwd identify
=> /usr/local/bin/identify
share|improve this question
up vote 31 down vote accepted

which will search your path for the arguments you supply, it's found on just about any BSD or SysV UNIX

moriarty:~ dave$ which bash true false
share|improve this answer
The which command though will work is generally not the right tool to use to do this type of work. See this U&L Q&A:… – slm Nov 8 '13 at 22:13
On OSX, which does not give any results for a custom script (that is in $PATH). type does. – wisbucky Apr 15 at 18:23

If you use the bash builtin type, it will show you all the (in-path) locations for a command:

$ type -a ls
ls is aliased to `ls --color=always'
ls is /bin/ls

$ type -a printf
printf is a shell builtin
printf is /usr/bin/printf

$ type -a touch
touch is /usr/bin/touch
touch is /bin/touch

If the command is a function, it will list the function definition:

$ type -a somefunc
somefunc is a function
somefunc ()
    echo "hello, world"

These examples are from a Ubuntu system, but the results will be similar for OS X.

share|improve this answer
On OSX, which does not show the path for a custom script (that is in $PATH). type does. – wisbucky Apr 15 at 18:23

try 'locate identify'

share|improve this answer
This works when "which" won't because the executable is not in your current PATH, but also tends to spew a lot of stuff you don't want. First path filter: "locate command | grep bin". Use "which" first. – dmckee Jun 12 '09 at 14:32
that's a good call, thanks. – Chopper3 Jun 12 '09 at 14:40

It depends on what you're looking for. Most of the utilities depend on the path variable. However, if what you're looking for is in your path chances are you don't really need to know where it is unless there are multiple copies of the same executable.

This doesn't apply to most things running in OSX though because they aren't run quite like normal linux/unix binaries. Here are some methods to find things that aren't in your path statement.


sudo find / -name <FILE>

This will find anything that exists on the file system you give as the first argument. It need to run as root to search private directories. It also supports wildcards if you're not completely sure of the name.


If you have the file in finder you can open a terminal window and drop the file into it. Terminal with then display the full path to the file.


Pretty self explanatory. You're donating processor cycles to allow it to keep an index of your fi

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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