怎么在linux中查询yum,linux - 如何使用YUM列出包的内容?
linux - 如何使用YUM列出包的內容?
我知道如何使用rpm列出包的內容(rpm -qpil package.rpm)。 但是,這需要知道.rpm文件在文件系統(tǒng)上的位置。 更優(yōu)雅的解決方案是使用包管理器,在我的例子中是YUM。 如何使用YUM實現(xiàn)這一目標?
7個解決方案
405 votes
有一個名為yum-utils的軟件包,它基于YUM構建,包含一個名為dnf的工具,可以執(zhí)行此操作。
$ 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系統(tǒng)上,使用rpm v4.8.0,yum v3.2.29和repoquery v0.0.11,dnf不打印任何內容。
如果您遇到此問題,請嘗試添加dnf標志:yum-utils。
dnf更新:
要使用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
Thomas Vander Stichele answered 2019-02-03T20:02:12Z
135 votes
rpm -ql [packageName]
例
# 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
無需安裝yum-utils,也無需知道rpm文件的位置。
Levit answered 2019-02-03T20:02:35Z
74 votes
$ yum install -y yum-utils
$ repoquery -l packagename
Hüseyin Ozan TOK answered 2019-02-03T20:02:51Z
28 votes
我不認為你可以使用yum列出包的內容,但是如果你的本地系統(tǒng)上有.rpm文件(很可能是所有已安裝包的情況),你可以使用rpm命令列出 該包的內容如下:
rpm -qlp /path/to/fileToList.rpm
如果您沒有包文件(.rpm),但安裝了包,請嘗試以下操作:
rpm -ql packageName
Thomi answered 2019-02-03T20:03:19Z
3 votes
這里有幾個很好的答案,所以讓我提供一個可怕的答案:
: you can type in anything below, doesnt have to match anything
yum 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 want
find /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 contents
echo '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
barrycarter answered 2019-02-03T20:03:41Z
0 votes
百勝沒有它自己的包裝類型。 百勝經營并幫助管理RPM。 因此,您可以使用yum列出可用的RPM,然后運行rpm -qlp命令以查看該程序包的內容。
Haabda answered 2019-02-03T20:04:03Z
0 votes
目前yum已集成到dnf和repoquery,因此輸入:
dnf repoquery -l
將列出遠程存儲庫中的包內容(即使對于尚未安裝的包)
意味著該功能不再需要安裝單獨的yum或dnf軟件包,因為它現(xiàn)在本身受支持。
用于列出已安裝或本地(yum文件)包的內容有dnf
我不認為這是可能的yum org dnf(不是repoquery子命令)
如果我錯了,請糾正我
w17t answered 2019-02-03T20:04:57Z
總結
以上是生活随笔為你收集整理的怎么在linux中查询yum,linux - 如何使用YUM列出包的内容?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: es6去除重复项_Excel的去除重复项
- 下一篇: 刻画小狗状态java_JAVA面向接口编