which - report full paths of commands


which [option] [commands]


which prints the full paths to the commands given as arguments, depending on the $PATH environment variable. Nothing is printed if the command is not found.


which accepts the following options:


Print out a short help message, then exit.


Print out its version number, then exit.


Print out all instances of command on $PATH not just the first.


Stop parsing for options. Useful if you want to find where in your path the commands --help, -a, and --version are found. Use which -- -- to find the path to --.


The environment variable $PATH (also DCL$PATH under DCL; or $Commands under MPW) is used to find the list of directories to check for commands. The variable %PATHEXT% is examined for command extensions if it exists.


which has no known bugs.


Traditionally, which also parses ones ~/.cshrc file to look for aliases, and reporting the alias when applicable. This version of which does not do that, because there are more shells than csh.

which will examine aliases under MPW (Mac) and symbols under DCL (VMS).


The Perl implementation of which was written by Abigail, Portability enhancements by Peter Prymmer.


This program is copyright by Abigail 1999.

This program is free and open software. You may use, modify, distribute and sell this program (and any modified variants) in any way you wish, provided you do not restrict others to do the same.