How do I find the package providing an alias?

Solution 1:

If you download dwww with the command

sudo apt install dwww

you can use dwww-quickfind, one of its sub-packages, in order to, well, quickly find it. The following is from the dwww man-page:

dwww-quickfind(8)

        Used by dwww-find(8) to  quickly  find  which
        package a program belongs to.

Just to test out the interface, from the terminal, ran it for 10 - 15 commands, some GNU, others not, without issue. For example, when I ran

:~$ dwww-quickfind man

and the result was

man-db
VIRTUAL: man-db

It obviously follows symlinks, so I would guess that it tracks aliases as well. Either way, It is worth a shot. Even if it doesn't, just getting dwww is worth the trouble. Type dwww <any-pkg> and you will understand.

It is like the man command on steroids.

Solution 2:

The problem with symlinks is they aren't necessarily installed by packages.

You can use readlink -f [/path/file] to (try to) get the path to the real file. If /path/file is a symlink, readlink will return the file that the symlink points to. If there is a chain of symlinks, readlink will follow them until it gets to a break in the chain or the real file.

Then you can use apt-file to search for the packages.