Search for apt packages

Quite often you want to compile or run something and all you get is something like “Error: libXYZ1.2.3.so not found”.

In these cases I usually used

apt-cache search XYZ

in order to find out which package might be missing on my Debian system.

If the package name really contains XYZ then I’d find it. But if libXYZ is actually in package ABC I would not.

A much better tool for this is ‘apt-file’. You’ll probably have to install it. The package like the command is simply called ‘apt-file’.

Then a

apt-file search libXYZ1.2.3.so

will most certainly find the package you have to install in order to get the libXYZ1.2.3.so !

Often apt-file returns a lot of not so useful stuff. If you’re looking for a specific command, try searching for ‘/usr/bin/command’, e.g.

apt-file search /usr/bin/nmap

if you want to know which package contains the nmap tool.

Caveat: apt-file uses your local apt cache. Make sure it’s up-to-date with

apt-get update