我们经常会遇到新装机器或者用别人的linux机器的时候找不到某个命令出自哪个软件包而不知道如何安装的情况,用如下命令可以解决
yum provides TARGET
举例说明:
#要找到lsb—release命令出自哪个包
可以用
yum provides */lsb_release
输出如下:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* epel: mirrors.yun-idc.com
* extras: mirror.bit.edu.cn
* rpmfusion-free-updates: mirror.bjtu.edu.cn
* rpmfusion-nonfree-updates: mirrors.ustc.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
redhat-lsb-core-4.0-7.el6.centos.i686 : LSB base libraries support for CentOS
Repo : base
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.0-7.el6.centos.x86_64 : LSB base libraries support for CentOS
Repo : base
Matched from:
Filename : /usr/bin/lsb_release
dkms-2.4.0-1.20170926git959bd74.el6.noarch : Dynamic Kernel Module Support Framework
Repo : epel
Matched from:
Filename : /usr/lib/dkms/lsb_release
redhat-lsb-core-4.0-7.el6.centos.x86_64 : LSB base libraries support for CentOS
Repo : installed
Matched from:
Filename : /usr/bin/lsb_release
这里因为我已经安装了,所以提示了我文件位置(安装了找不到也可以这样找)
最重要的是如这行
redhat-lsb-core-4.0-7.el6.centos.i686 : LSB base libraries support for CentOS
说明是这个redhat-lsb-core-4.0-7.el6.centos.i686包提供的,一般来说安装的时候一般不用输入全名,只输入redhat-lsb-core就可以