如何使用YUM列出包装内容? [英] How to list the contents of a package using YUM?
问题描述
我知道如何使用rpm列出软件包(rpm -qpil package.rpm
)的内容.但是,这需要知道.rpm文件在文件系统上的位置.一个更优雅的解决方案是使用程序包管理器,在我的情况下是YUM. YUM如何用于实现这一目标?
I know how to use rpm to list the contents of a package (rpm -qpil package.rpm
). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?
推荐答案
有一个名为yum-utils
的程序包,它基于YUM构建,并包含一个可以执行此操作的名为repoquery
的工具.
There is a package called yum-utils
that builds on YUM and contains a tool called repoquery
that can do this.
$ repoquery --help | grep -E "list\ files"
-l, --list list files in this package/group
结合为一个示例:
$ repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
在至少一个RH v4.8.0,yum v3.2.29和repoquery v0.0.11的RH系统上,repoquery -l rpm
不打印任何内容.
On at least one RH system, with rpm v4.8.0, yum v3.2.29, and repoquery v0.0.11, repoquery -l rpm
prints nothing.
如果遇到此问题,请尝试添加--installed
标志:repoquery --installed -l rpm
.
If you are having this issue, try adding the --installed
flag: repoquery --installed -l rpm
.
要使用dnf
代替yum-utils
,请使用以下命令:
To use dnf
instead of yum-utils
, use the following command:
$ dnf repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
这篇关于如何使用YUM列出包装内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!