本文翻译自:How to list the contents of a package using YUM?

I know how to use rpm to list the contents of a package ( rpm -qpil package.rpm ). 我知道如何使用rpm列出包的内容( rpm -qpil package.rpm )。 However, this requires knowing the location of the .rpm file on the filesystem. 但是,这需要知道.rpm文件在文件系统上的位置。 A more elegant solution would be to use the package manager, which in my case is YUM. 更优雅的解决方案是使用包管理器,在我的例子中是YUM。 How can YUM be used to achieve this? 如何使用YUM实现这一目标?


#1楼

参考:https://stackoom.com/question/R4J/如何使用YUM列出包的内容


#2楼

I don't think you can list the contents of a package using yum, but if you have the .rpm file on your local system (as will most likely be the case for all installed packages), you can use the rpm command to list the contents of that package like so: 我不认为你可以使用yum列出包的内容,但是如果你的本地系统上有.rpm文件(很可能是所有已安装包的情况),你可以使用rpm命令列出该包的内容如下:

rpm -qlp /path/to/fileToList.rpm

If you don't have the package file (.rpm), but you have the package installed, try this: 如果您没有包文件(.rpm),但安装了包,请尝试以下操作:

rpm -ql packageName

#3楼

Yum doesn't have it's own package type. 百胜没有它自己的包装类型。 Yum operates and helps manage RPMs. 百胜经营并帮助管理RPM。 So, you can use yum to list the available RPMs and then run the rpm -qlp command to see the contents of that package. 因此,您可以使用yum列出可用的RPM,然后运行rpm -qlp命令以查看该程序包的内容。


#4楼

There is a package called yum-utils that builds on YUM and contains a tool called repoquery that can do this. 有一个名为yum-utils的包,它基于YUM构建,并包含一个名为repoquery的工具,可以执行此操作。

$ repoquery --help | grep -E "list\ files" -l, --list            list files in this package/group

Combined into one example: 结合成一个例子:

$ 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

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. 在至少一个RH系统上,使用rpm v4.8.0,yum v3.2.29和repoquery v0.0.11, repoquery -l rpm打印任何内容。

If you are having this issue, try adding the --installed flag: repoquery --installed -l rpm . 如果您遇到此问题,请尝试添加--installed标志: repoquery --installed -l rpm


DNF Update: DNF更新:

To use dnf instead of yum-utils , use the following command: 要使用dnf而不是yum-utils ,请使用以下命令:

$ 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

#5楼

rpm -ql [packageName]

Example

# rpm -ql php-fpm/etc/php-fpm.conf
/etc/php-fpm.d
/etc/php-fpm.d/www.conf
/etc/sysconfig/php-fpm
...
/run/php-fpm
/usr/lib/systemd/system/php-fpm.service
/usr/sbin/php-fpm
/usr/share/doc/php-fpm-5.6.0
/usr/share/man/man8/php-fpm.8.gz
...
/var/lib/php/sessions
/var/log/php-fpm

No need to install yum-utils, or to know the location of the rpm file. 无需安装yum-utils,也无需知道rpm文件的位置。


#6楼

There are several good answers here, so let me provide a terrible one: 这里有几个很好的答案,所以让我提供一个可怕的答案:

: you can type in anything below, doesnt have to match anythingyum whatprovides "me with a life": result of the above (some liberties taken with spacing):Loaded plugins: fastestmirror
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/4): extras/7/x86_64/primary_db | 166 kB 00:00
(2/4): base/7/x86_64/group_gz | 155 kB 00:00
(3/4): updates/7/x86_64/primary_db | 9.1 MB 00:04
(4/4): base/7/x86_64/primary_db | 5.3 MB 00:05
Determining fastest mirrors* base: mirrors.xmission.com* extras: mirrors.xmission.com* updates: mirrors.xmission.com
base/7/x86_64/filelists_db | 6.2 MB 00:02
extras/7/x86_64/filelists_db | 468 kB 00:00
updates/7/x86_64/filelists_db | 5.3 MB 00:01
No matches found: the key result above is that "primary_db" files were downloaded: filelists are downloaded EVEN IF you have keepcache=0 in your yum.conf: note you can limit this to "primary_db.sqlite" if you really wantfind /var/cache/yum -name '*.sqlite': if you download/install a new repo, run the exact same command again
: to get the databases for the new repo: if you know sqlite you can stop reading here: if not heres a sample command to dump the contentsecho 'SELECT packages.name, GROUP_CONCAT(files.name, ", ") AS files FROM files JOIN packages ON (files.pkgKey = packages.pkgKey) GROUP BY packages.name LIMIT 10;' | sqlite3 -line /var/cache/yum/x86_64/7/base/gen/primary_db.sqlite : remove "LIMIT 10" above for the whole list: format chosen for proof-of-concept purposes, probably can be improved a lot

如何使用YUM列出包的内容?相关推荐

  1. 怎么在linux中查询yum,linux - 如何使用YUM列出包的内容?

    linux - 如何使用YUM列出包的内容? 我知道如何使用rpm列出包的内容(rpm -qpil package.rpm). 但是,这需要知道.rpm文件在文件系统上的位置. 更优雅的解决方案是使用 ...

  2. linux yum list包数量少,Linux基础知识之YUM包管理工具

    一.YUM简介 1.YUM: Yellowdog Update Modifier 完成RHEL系列前端自动解决依赖关系安装工具,依赖rpm存在 2.工作模式:C/S架构 Server端(yum仓库): ...

  3. linux移除包的命令,linux的yum卸载包命令说明

    Linux中的yum命令可以通过相关命令对包进行安装.卸载或者更新等,下面由学习啦小编为大家整理了Linux的yum卸载包命令说明的相关知识,希望对大家有帮助! linux的yum卸载包命令说明 1& ...

  4. fedora17用yum下载包而不安装包

    fedora17用yum下载包而不安装 1, 设置yum保存安装的临时rpm软件包 vi /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/ ...

  5. 9.JAVA之GUI编程列出指定目录内容

    代码如下: /*列出指定目录内容*/ import java.awt.Button; import java.awt.FlowLayout; import java.awt.Frame; import ...

  6. PHP 实现列出目录的内容

    PHP 实现列出目录的内容 <?phpfunction list_files($dir) { if(is_dir($dir)) { if($handle = opendir($dir)) { w ...

  7. Linux 命令之 tree -- 以树状图列出目录的内容/查看目录内容

    文章目录 一.命令介绍 二.常用选项 三.命令示例 (一)按树形结构显示当前目录下的内容 (二)按树状图显示当前目录下的所有目录名称而非文件 (三)列出指定目录下的第一层级的文件和目录名称 (四)不显 ...

  8. linux 树状目录代码,Linux tree - 以树状图列出目录的内容

    用途说明 tree命令以树状图列出目录的内容(list contents of directories in a tree-like format.).通常在写文档时需要列一下文件目录结构,这个时候t ...

  9. linux文件目录类、pwd 显示当前工作目录的绝对路径、列出目录的内容

    1.2文件目录类 1.2.1pwd 显示当前工作目录的绝对路径 pwd的全称是print working directory 打印工作目录 pwd (功能描述:显示当前工作目录的绝对路径) 例如: [ ...

最新文章

  1. 【C++ 语言】线程安全队列 ( 条件变量 | 线程调度 )
  2. 未来计算机论文1500,致未来的自己作文1500字
  3. 剑指offer面试题32 - II. 从上到下打印二叉树 II(二叉树)(BFS)
  4. 关于百度地图根据经纬度获取城市信息的接口
  5. 使用MisakaPatcher制作Galgame外挂汉化补丁
  6. 怎么从已有文件中挑选需要的文字重新生成新文件_CAD问题全面解答(几乎涵盖了CAD使用的全部问题)...
  7. 系统运维数据存储知识-系统数据误删除恢复
  8. 智能家居带动路由器换代潮 中高端市场大门已敞开
  9. 利用halcon识别汽车检具孔面积和孔间距
  10. android水印控件,Android图片添加文字水印并保存水印文字图片到指定文件
  11. Photoshop的时间轴是灰色的,不能使的解决方法
  12. 移动端h5页面打开高德地图或者百度地图实现导航
  13. smartfroms word编辑_word如何改变smartart word如何编辑smartart
  14. 我的新书 asp net开发技巧精讲
  15. python 计时方法_Python计时器类| cancel()方法与示例
  16. 全球量子科技与工业快讯(第一期)
  17. mix3刷魔趣(简记)
  18. linux下防止rm-rf /处理,削减删除的影响力!
  19. 树莓派人脸识别门禁系统第二课:Win IOT微软人脸识别API刷脸开门
  20. 什么是VMOS功率场效应管,工作原理是什么

热门文章

  1. linux下使用rpm安装libxml2,gcc,gcc-c++等基本包
  2. HashMap 源码深入浅出
  3. Google Play服务中的人脸检测
  4. Android 之surfaceView (画动态圆圈)
  5. JVM判断对象是否已死?
  6. 人工智能实践:TensorFlow笔记学习(四)—— 神经网络优化
  7. iOS自定义View 控件自动计算size能力
  8. (0082)iOS开发之搭建iOS自动化打包平台(利用Jenkins持续集成iOS项目)
  9. (0046) iOS开发之View的frame和bounds之解惑
  10. php操作MySQL