Thursday, June 5, 2014

How to check which package a file belongs to in Redhat or Centos

If the package is not installed, run below commands (in this example, i use mkpasswd as an example):
$ yum whatprovides "*/mkpasswd" 
OR
$ repoquery -q --file */mkpasswd


If the package is installed:
$ rpm -qf /usr/bin/mkpaswd