centos查看一个命令应该安装哪个包

有时候缺少命令,但是又不知道安装哪个包,可以使用如下进行查找

dnf -q provides '*/vim'
yum provides '*/vim'

这两个命令效果一样

比如我们需要安装vim,那么可以查询一下,得到如下结果

vim-common-2:8.0.1763-15.el8.x86_64 : The common files needed by any version of the VIM editor
Repo        : AppStream
Matched from:
Filename    : /usr/share/vim

vim-common-2:8.0.1763-16.el8.x86_64 : The common files needed by any version of the VIM editor
Repo        : @System
Matched from:
Filename    : /usr/share/vim

vim-common-2:8.0.1763-16.el8.x86_64 : The common files needed by any version of the VIM editor
Repo        : appstream
Matched from:
Filename    : /usr/share/vim

vim-enhanced-2:8.0.1763-15.el8.x86_64 : A version of the VIM editor which includes recent enhancements
Repo        : AppStream
Matched from:
Filename    : /usr/bin/vim

vim-enhanced-2:8.0.1763-16.el8.x86_64 : A version of the VIM editor which includes recent enhancements
Repo        : @System
Matched from:
Filename    : /usr/bin/vim

vim-enhanced-2:8.0.1763-16.el8.x86_64 : A version of the VIM editor which includes recent enhancements
Repo        : appstream
Matched from:
Filename    : /usr/bin/vim

上面列出了可以安装的包vim-common vim-enhanced都可以安装得到vim

上面语句的意思就是查找提供安装路径为*/vim的包,这是一个通配符,与上面的Filename匹配

posted @ 2022-08-10 11:23  秋来叶黄  阅读(291)  评论(0编辑  收藏  举报