linux rpm 查找,Linux rpm命令的查询模式常用方式举例

rpm命令的查询模式语法:

rpm {-q|--query} [select-options] [query-options]

{...}表示必选部分,[...]表示可选部分

其中:

select-options表示查询的范围,比如:按照文件查还是包查,可以是:

PACKAGE_NAME:包的名字

-a, --all:查询所有的已安装包

-f, --file FILE:查询文件FILE所属的包

-p, --package PACKAGE_FILE:查询安装包文件所在的包

按照“包的名称”查询,名称只要匹配到关键字就可以:

[irixgl@irixgl ~]$ rpm -q coreutils-

coreutils-8.5-6.fc14.i686

按照“文件所属的包”查询

[irixgl@irixgl ~]$ rpm -qf /sbin/grubby

grubby-7.0.16-1.fc14.i686

按照包文件查询

[irixgl@irixgl ~]$ rpm -qp grubby-7.0.16-1.fc13.src.rpm

warning: grubby-7.0.16-1.fc13.src.rpm: Header V3 RSA/SHA256 Signature, key ID e8e40fde: NOKEY

grubby-7.0.16-1.fc13.x86_64

上述每种方式可以叠加下面的query-options

query-options可以是:

-d, --docfiles:列出包里面的文档,用于了解man信息

-i, --info:列出包的基本信息

-l, --list:列出包里面包含的文件列表

--provides:列出包所提供的能力集

-R, --requires:列出包所依赖的能力集

查询/sbin/grubby文件所在的包的基本信息

[irixgl@irixgl ~]$ rpm -qfi /sbin/grubby

Name        : grubby                       Relocations: (not relocatable)

Version     : 7.0.16                            Vendor: Fedora Project

Release     : 1.fc14                        Build Date: Wed 14 Jul 2010 02:48:10 AM CST

Install Date: Sat 23 Oct 2010 02:16:37 AM CST      Build Host: x86-14.phx2.fedoraproject.org

Group       : System Environment/Base       Source RPM: grubby-7.0.16-1.fc14.src.rpm

Size        : 83020                            License: GPLv2+

Signature   : RSA/SHA256, Thu 29 Jul 2010 04:49:34 PM CST, Key ID 421caddb97a1071f

Packager    : Fedora Project

URL         : http://git.fedorahosted.org/git/grubby.git

Summary     : Command line tool for updating bootloader configs

Description :

grubby  is  a command line tool for updating and displaying information about

the configuration files for the grub, lilo, elilo (ia64),  yaboot (powerpc)

and zipl (s390) boot loaders. It is primarily designed to be used from scripts

which install new kernels and need to find information about the current boot

查询/sbin/grubby文件所在的包里面包含的文件

[irixgl@irixgl ~]$ rpm -qfl /sbin/grubby

/sbin/grubby

/sbin/installkernel

/sbin/new-kernel-pkg

/usr/share/doc/grubby-7.0.16

/usr/share/doc/grubby-7.0.16/COPYING

/usr/share/man/man8/grubby.8.gz

/usr/share/man/man8/installkernel.8.gz

/usr/share/man/man8/new-kernel-pkg.8.gz

查询/sbin/grubby所在的包安装后依赖的文件

[irixgl@irixgl ~]$ rpm -qfR /sbin/grubby

/bin/bash

/bin/sh

libblkid.so.1

libblkid.so.1(BLKID_1.0)

libc.so.6

libc.so.6(GLIBC_2.0)

libc.so.6(GLIBC_2.1)

libc.so.6(GLIBC_2.2)

libc.so.6(GLIBC_2.3)

libc.so.6(GLIBC_2.3.4)

libc.so.6(GLIBC_2.4)

libglib-2.0.so.0

libpopt.so.0

libpopt.so.0(LIBPOPT_0)

rpmlib(CompressedFileNames) <= 3.0.4-1

rpmlib(FileDigests) <= 4.6.0-1

rpmlib(PayloadFilesHavePrefix) <= 4.0-1

rtld(GNU_HASH)

rpmlib(PayloadIsXz) <= 5.2-1

格式举例:

--qf|--queryformat QUERYFMT

QUERYFMT = 用""括起来,例如""%{NAME}-%{VERSION}"

文件解包:

rpm2cpio xxx.rpm | cpio -idmv0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值