I’ve got a command docker on my machine. I need to upgrade it. So, who owns it?
This is always a bit of a detective story. The question is type:
$ type -a docker
docker is /usr/local/bin/docker
“If docker was a command, how would you interpret it?” -a means “List all occurrences.” I still don’t know who owns docker.
Next, which:
$ which -a docker
/usr/local/bin/docker
“Locate this program and list all answers.” Nothing new.
Finally, ls -l:
$ ls -l /usr/local/bin/docker
/usr/local/bin/docker -> /Applications/Docker.app/Contents/Resources/bin/docker
“List directory contents of this directory, long format.” Boom. Docker Desktop owns docker. If I want to upgrade it, I have to upgrade Docker Desktop.
Bonus: if you’re using Mac and Homebrew, you can check that too, with brew info <package>. Packages Homebrew knows about will be described, and those that it doesn’t will report “No available formula.”
See man type, man which, and man ls for more info.