which - locate a program file (or files) in the path
which [-a] name [...]
which takes a list of names and looks for the files which
would be executed
had these names been given as commands. Each argument
for along the user's path.
If the -a flag is given, which will return a list of all
of just the first match.
The which utility exits with one of the following values:
0 All names were successfully resolved.
1 Some names were resolved but not all.
2 No names were resolved.
-1 A system error occurred.
The following environment variables affect the execution of
PATH A colon-separated list of directories in which to find
If PATH is not set, and the given name is not a fully
relative pathname, which will fail.
A diagnostic is given if an executable file with the argument name was
not found in the path.
csh(1), find(1), locate(1), sh(1), whereis(1), environ(7)
A which command appeared in 3.0BSD.
The which command formerly was a csh(1) script and could expand aliases.
csh(1) now has a built-in which command so this version is
use with other shells like sh(1).
OpenBSD 3.6 February 21, 1997
[ Back ]