the which
command you're using assumes the argument "my_command" is inside your PATH. which
searches via your global environment variable PATH for the argument that you type and lists the complete path to the first match it finds.
You can find your path by typing env on the command line and looking for PATH=.
whereis
- searches for files in a restricted set of locations, such as standard binary file directories, library directories, and man page directories. This utility is a quick way to find program executables and related files like documentation or configuration files.(This does not search user directories or many other locations that are easily searched by find or locate)
and of course if you know the general location you can use the find
or locate
command.
type command
-- This will tell you what the shell would actually execute (which might be built-in to the shell) – John1024 Apr 13 '15 at 03:28type ls
type cat
which returned the aliases I had those commands set to. Then my brain threw together junk and typed it... I need sleep. – Torger597 Apr 13 '15 at 03:42which -s
in xonsh – Andrew Nov 16 '22 at 01:58