which
which returns the pathnames of the files (or links) which would be executed in the current environment, had its arguments been given as commands in a strictly POSIX-conformant shell.

which -a
-a, Print all matching pathnames of each argument.
Exit Statuses
0 If all specified commands are found and executable
1 If one or more specified commands is nonexistent or not executable
2 If an invalid option is specified.