How to check a file belongs to which rpm package in Linux
Find rpm package name of a file in Linux
You may want to know a file owned by which rpm package in Linux.
Redhat Package Manager (rpm) has can help you to get that information. It is pretty simle, just use the combination of options “qf”. “q” for query rpm database and “f” for file.
In the below example, I am trying to findout “libpthread.so.0” belonsgs to which rpm package.
The rpm query resulted package name “glibc-2.17-157.el7.x86_64”
[root@electronproton ~]# rpm -qf /lib64/libpthread.so.0 glibc-2.17-157.el7.x86_64
In the below example, I am trying to find out “/lib64/libgomp.so.1” belongs to which rpm package.
The rpm query resulted from package name “libgomp-4.8.5-11.el7.x86_64”
[root@electronproton ~]# rpm -qf /lib64/libgomp.so.1 libgomp-4.8.5-11.el7.x86_64
It is very useful in debugging. Hope you understood the concept.