yum 如何判断某个命令在哪个包中
场景#
当我们希望安装 wget 命令,而包的名字也是wget,这时使用yum install wget即可,很多软件安装包均是如此。但也有很多不同,比如 nslookup 命令所在的包就是 bind-utils ,安装包名就不同,实际上 yum 提供了很多命令可以进行搜索,比如 yum provides 或者 yum whatprovides。
yum provides 和 yum whatprovides 很类似,因此这里只介绍 yum provides。
查询 nslookup 所在的安装包:
[root@host1 golang]# yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
WANdisco-git/7/x86_64/filelists_db | 172 kB 00:00:01
base/7/x86_64/filelists_db | 7.2 MB 00:00:01
extras/7/x86_64/filelists_db | 277 kB 00:00:00
updates/7/x86_64/filelists_db | 9.4 MB 00:00:01
32:bind-utils-9.11.4-26.P2.el7.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.2.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.4.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.5.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.7.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.8.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.9.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
[root@host1 golang]#
可以看到,nslookup 命令在 bind-utils 包中,因此需要使用 nslookup 命令就得安装 bind-utils 包:
yum install -y bind-utils
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南