For example, if passed
ls as input it should tell me that
/bin/ls will run if run
ls on the command-line.
migrated from stackoverflow.com Oct 29 '11 at 16:16
The command to use varies from shell to shell.
Only a shell built-in will tell one correctly what the shell will do for a given command name, since only built-ins can fully know about aliases, shell functions, other built-ins, and so forth. Remember: Not all commands correspond to executable files in the first place.
You can use
It works by searching the
The command which finds the actual executable is
To see all the intermediate links: