Thursday, March 01, 2012

Find the package that a particular file belongs to

There are times when we need to know the package that contains the particular file. Cases like while compiling we need to install a given library and we don't know which package to install. Well in that case we can’t install the library as it is contained in the package itself. So there the task seems impossible though that it is not quite so.

We will start with Ubuntu, where we have to get a package called apt-file from internet. Follow the below mentioned steps to do so.

$ sudo apt-get install apt-file

After the package has been downloaded and installed, we need to update it.
$ sudo apt-file update

That is it in Ubuntu and now we can go ahead and search for a particular package.
$ sudo apt-file search <file name>

For RedHat & Fedora distros
$ rpm -qf <file name>

In Solaris 10
$ grep -i <file name> /var/sadm/install/contents


  1. Hello there! What is yous point of view on commercials of any kinds on blogging resources?