I use the command whereis rm
$ whereis rm
/bin/rm
Then I try which rm
$ which rm
/usr/local/opt/coreutils/libexec/gnubin/rm
The results are different... so which rm
will be called when I run a command like rm readme
?
I use the command whereis rm
$ whereis rm
/bin/rm
Then I try which rm
$ which rm
/usr/local/opt/coreutils/libexec/gnubin/rm
The results are different... so which rm
will be called when I run a command like rm readme
?
This answer on Super User by Denilson Sá Maia may be useful:
According to manual of
which
:According to manual of
whereis
:So clearly there is a very thin of difference among them.
which
results include path of executable file whilewhereis
results in binaries and documentation.For example, consider java:
which
results in just one path, i.e. path of java executable filewhereis
results in about paths, i.e. path of java binary, source and manual