The whereis command allow us to find where a binary it is stored. For example, to find the java binaries:

whereis java

Output:

java: /usr/bin/java /usr/include/java /usr/share/java /usr/lib/jvm/java-11-openjdk/bin/java

type

type command shows which command the shell executes:

type java

Output:

java is /usr/bin/java

👉 Source