Share this post with your friends
In your system administration life time, suppose you're looking forward to edit a configuration file and it turns out that the file is not available. You forgot what package to install to have that file or what package contains that file. What would you do then? To get the answer, read this post.
To find out which package in the repository contains a specific file, you can use the
repoquery command. The syntax to do that is,
repoquery -qf file_path
file_path is the file that you're looking for.
Example: Find the package that is associated with a specific file
To check what package provides the file
/etc/my.cnf, run the following command.
repoquery -qf /etc/my.cnf
From the output, we can see that the packages that provides the specific file
Tested on: CentOS 7