Locates a program file, including aliases and paths.
which [ Name ... ]
The which command takes a list of program names and looks for the files that run when these names are given as commands. The which command expands each argument, if it is aliased, and searches for it along the user's path. The aliases and paths are taken from the .cshrc file in the user's home directory. If the .cshrc file does not exist, or if the path is not defined in the .cshrc file, the which command uses the path defined in the user's environment.
A diagnostic is given if a name is aliased to more than a single word or if an executable file with the argument name is not found in the path.
In the Korn shell, you can use the whence command to produce a more verbose report. For more information on the whence command, see Korn shell or POSIX shell built-in commands.
To find the executable file associated with a command name of lookup:
which lookup
Item | Description |
---|---|
$HOME/.cshrc | Contains the source of aliases and path values. |