When you are compiling there are times, when you need to install a given library, but the problem is that you do not know which package to install.
I mean you can't install the library itself as it is contained in a given package, you first need to know which package it belongs to. Once you know that, you can install that package and continue with your job.
Let's now see how to do it in some Linux distributions.
Let's start with the most famous Linux distributions
Debian, Ubuntu and derivatives
apt-file. First install it.
apt-get install apt-file
Update its database:
And now search for a specific file.
apt-file search [file you are looking for]
If you are using one of my favorite distributions, just use
pacman -Qo [file you are looking for]
pacman -Qo identify
/usr/bin/identify is owned by imagemagick 184.108.40.206-1
You can also use
pkgfile similar to the Debian tool, so let's install it:
pacman -S pkgtools
Then just look for the file with:
pkgfile [file you are looking for]
Redhat, Fedora en derivatives
If you are using a Redhat derivative, there is also a solution for you, just use rpm:
rpm -qf [file you are looking for]
[Update] From an email I got, I have been told that this is the real command to be used in *rpm based distributions.
yum provides */[file]