Locate a program file (UNIX)
which [-afLls] program...
- Find all occurrences of program in PATH.
- Display the full pathname.
- Display the long format (as in ls -l) for each program found, displaying link information if the file is a symlink.
- (el) Display the long format (as in ls -l) for each program found.
- Search for shared objects in the directories identified by the LD_LIBRARY_PATH environment variable and the _CS_LIBPATH configuration string.
The which utility searches for the specified programs. By default, which searches the directories listed by your PATH environment variable, but if you specify the -s option, it searches the directories specified by LD_LIBRARY_PATH and _CS_LIBPATH.
The Korn shell has a builtin whence command that's similar to the which utility but also tells you if the given command is a reserved word, alias, builtin command, and so on. For more information, see the entry for ksh.
Display the full pathname and long status for all versions of the ls utility found in PATH:
which -alf ls
Display the pathname for the which utility:
- A colon-separated list of directories to search for executables.
- A colon-separated list of directories to search for shared libraries.
- All input files were found.
- An error occurred.
Last modified: 2013-09-30