Linux and Unix which command
which returns the pathnames of the files (or links) which would be executed in the current environment, had the filename (or filenames) been given as a command (or commands) in a strictly POSIX-conformant shell. It does this by searching the paths in the PATH environment variable for executable files matching the names of the arguments.
which does not follow symbolic links.
which -a [filename] ...
|-a||Print all matching pathnames of each matching filename.|
which returns the following value, depending on what occurred:
|0||All filenames were found, and all were executable.|
|1||One or more filenames were not found, or were not executable.|
|2||An invalid option was specified.|
Locates the pathname of the file which would be run if the sh command were executed. On most systems, this will output: