There are a few ways to find the name of the package that installed a particular file on the system. We can use yum, repoquery or the rpm commands to find the name of the package for a particular file.
Using “repoquery”
“repoquery” is one of the tools installed by the yum-utils package. Let’s find what package provides the binary “/bin/bash”.
[root@c7vanilla ~]# rpmquery --whatprovides /bin/bash bash-4.2.46-19.el7.x86_64
Using “yum”
[root@c7vanilla ~]# yum -q whatprovides /bin/bash bash-4.2.46-19.el7.x86_64 : The GNU Bourne Again shell Repo : base Matched from: Filename : /bin/bash bash-4.2.46-19.el7.x86_64 : The GNU Bourne Again shell Repo : @base Matched from: Filename : /bin/bash
NOTE: You can either “whatprovides” or “provides” to get the same output.
Using “rpm”
[root@c7vanilla ~]# rpm -qf /bin/bash bash-4.2.46-19.el7.x86_64