If you want to find the relationship between files on your system and RPM packages (which one owns/belongs-to which) then this page will be of help to you.
1. Contents of an RPM package
1.1.1. This RPM command will show you the contents of a package which is already installed on your system:
rpm -ql <package-name.rpm>
For example: rpm -ql skype
will list all the files that the skype package installed onto your system. Note that you don’t need to give the exact name of the package (like skype-2.0.0.72-fc5.i586 in my case). Of course giving the exact name of the package will also work (provided you type it correctly).
1.1.2 Here’s how to find the contents of an rpm package which is NOT yet installed (i.e. all the files inside the package, and where they will be installed):
rpm -qpl <path/to/file.rpm>
1.2. Which RPM package this file belongs to?
The below command will tell you what RPM package installed a given file onto your machine, i.e. what RPM package the file belongs to or which package “owns” the file (note that the file MUST be already installed for this to work):
rpm -qf /bin/bash
Try this on your system (must have bash :)) and you should see the rpm command output the name of the bash package, something like bash-3.2-23.fc9.i386
Often a poorly packaged app would miss a dependency – usually an shared object library (a .so file). In such cases you’d see an error like:
/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
So in this case it would be nice to find out which packages provides the ld-linux.so.2 file.
$ yum whatprovides ld-linux.so.2
glibc-2.14.90-14.i686 : The GNU libc libraries
Repo : fedora
Matched from:
Other : ld-linux.so.2
This tells us that the ld-linux so lib is provided by the glibc library. Note that you must give the exact so name to yum whatprovides, whereas when installing you may just type yum install glibc and it will find the correct version.
(Note: yum is Fedora’s package manager / frontend to the rpm command)
This is how you can list all the packages installed on your system:
yum list installed
The resulting list of packages will be quite long so if you have an idea what you’re looking for (e.g. if you looking for all the “ncurses” packages) you may do something like:
yum list installed | grep ncurses
And using dnf:
As you can see, in this case the pkg-config command is provided by both the @System and Updates repos.
– – – – –
Another similar and VERY useful command would be:
This will show you which version of the package (firefox in this example) is installed on your computer, if any, and which versions (higher AND lower) are available.
This way, if you need to, you could downgrade a package! In this particular case this is what the command output for me: