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. See "Korn Shell Special Commands" in AIX 5L Version 5.1 System User's Guide: Operating System and Devices for more information on the whence command.
To find the executable file associated with a command name of lookup:
which lookup
$HOME/.cshrc | Contains the source of aliases and path values. |
The csh command, find command, file command, ksh command, sh command, whereis command.
Shells Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices describes shells, the different types, and how they affect the way commands are interpreted.
Commands Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.