CentOS 和 RedHat 中,使用 yum 安装依赖包非常方便,但有时候我们只知道我们需要什么命令,却不知道使用该命令需要安装什么依赖包。
yum 提供了查询 “哪些软件包中有指定命令” 的功能,就是
yum provides
,示例如下:
1、示例一:ifconfig 命令
[root@test demo]# yum provides */ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.bfsu.edu.cn
net-tools-2.0-0.25.20131004git.el7.x86_64 : Basic networking tools
Repo : base
Matched from:
Filename :
结论:net-tools 软件包中有 ifconfig 命令,可以使用 yum -y install net-tools
安装后使用
2、示例二:nslookup 命令
[root@test demo]# yum provides */nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.bfsu.edu.cn
32:bind-utils-9.11.4-26.P2.el7.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename :