0

I looked around in coreutils, and did sudo apt-cache search which I also looked at the manpages of which, I didn't find it.

I'd like to add an argument for listing dependencies to the executable, I think it would be useful.

2 Answers 2

10

At least on my Ubuntu 22.04, /usr/bin/which is provided by the debianutils package:

$ update-alternatives --list which
/usr/bin/which.debianutils
$ 
$ dpkg -S /usr/bin/which.debianutils 
debianutils: /usr/bin/which.debianutils

It's a shell script - so no need to download the source:

$ file /usr/bin/which.debianutils 
/usr/bin/which.debianutils: POSIX shell script, ASCII text executable
1

On Ubuntu 18.04.6 LTS /usr/bin/which is in the path for a normal (non-root) user:

$ which which
/usr/bin/which

And the above is a symbolic link:

$ file /usr/bin/which
/usr/bin/which: symbolic link to /bin/which

And the target is a shell script:

$ file /bin/which
/bin/which: POSIX shell script, ASCII text executable

And the shell script is provided by debianutils

$ dpkg -S /bin/which
debianutils: /bin/which

The above answer is a variation of the answer from steeldriver, showing Ubuntu 18.04 is slightly different from Ubuntu 22.04.

Under Ubuntu 18.04 update-alternatives is reporting an error for which:

$ update-alternatives --list which
update-alternatives: error: no alternatives for which

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .