yum whatprovides
man 文档里面这样描述:
provides or whatprovides
Is used to find out which package provides some feature or file. Just use a specific name or a file-glob-syntax wildcards to list the packages available or installed that provide that feature or file.
yum whatprovides + 指令,来查看是哪一个软件包提供了这样要给指令
或者可以用
yum whatprovides + 文件,来查看是那儿一个软件包提供的这样的文件
同时我们还可以使用
rpm -qf +文件,来查看文件是那个软件包提供的
例如我们查看etc/hosts这样一个文件是谁提供的我们可以使用
yum whatprovides /etc/hosts
[root@VM_0_4_centos yum.repos.d]# yum whatprovides /etc/hosts
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
setup-2.8.71-10.el7.noarch : A set of system configuration
: and setup files
Repo : os
Matched from:
Filename : /etc/hosts
setup-2.8.71-10.el7.noarch : A set of system configuration
: and setup files
Repo : @anaconda
Matched from:
Filename : /etc/hosts
或者
rpm -qf /etc/hosts
[root@VM_0_4_centos yum.repos.d]# rpm -qf /etc/hosts
setup-2.8.71-10.el7.noarch
[root@VM_0_4_centos yum.repos.d]#
至于rpm -qf 能不能查询命令具体处于那儿一个软件包,我在仔细研究研究~~~~