How to find application's path from command line?
If it is in your path, then you can run either
which git. The
whichcommand has had problems getting the proper path (confusion between environment and dot files). For
type, you can get just the path with the
If it is not in your path, then it's best to look for it with
locate -b gitIt will find anything named 'git'. It'll be a long list, so might be good to qualify it with
locate -b git | fgrep -w bin.
I use `locate` endlessly (it is very fast), but for those unaware of it, `locate` is only as up to date as its most recent database update, which is automatically run daily on my Ubuntu. The *refresh* command is `sudo updatedb` ... Also `locate` has built-in regex capability, so commands like this works: `locate -br "^git$"` ... -b` means restrict the search to just the *basename* ... or without the `-b`, it searches the full pathname .. Also, it only searches paths you have configured it to search.. there is no command-line control of this other than your regex filters.
@Gilles, that's funny for me the behavior is exactly the opposite: `type` is a shell builtin that tells me aliases and such, and `which` is an external program that shows me the path to an executable... although if there's a builtin that gets in the way that executable won't get called.