macOS equivalent of the "where" command used in a Windows Command Prompt
In a Windows Command Prompt, I can find the location of things like Java and GIT by using the where
command.
For example, typing where java
yields C:\Program Files\Java\jdk1.8.0_05
.
What is the macOS Terminal equivalent for the Windows Command Prompt command, where
?
The which
command prints the most precedent application on the PATH whereas where
prints all matching applications on the path.
The difference manifests when you have side by side instances of an application installed and all set on the path. Strictly speaking which by itself returns the instance resolved first on the path left to right, where returns ALL found instances on the path resolved left to right. If you want to see what I'm talking about, on a Windows 7 or above system type:
where notepad
you may see two paths returned
C:\>where notepad
C:\Windows\System32\notepad.exe
C:\Windows\notepad.exe
The real equivalence is
which -a someApp
=== where someApp
The macOS Terminal equivalent of the Windows Command Prompt command where
is which
.
Typing which java
in my macOS Terminal yields /usr/bin/java
, and which git
yields /usr/bin/git
.