Welcome 微信登录

首页 / 操作系统 / Linux / 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-optionsquery-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 QUERYFMTQUERYFMT = 用""括起来,例如""%{NAME}-%{VERSION}"文件解包:rpm2cpio xxx.rpm | cpio -idmvLinux内核软中断线程对于通用内核线程的启示Git和Github初次使用相关资讯      Linux命令 
  • 48 字节命令可令 Linux 系统当机!  (今 07:55)
  • 在Linux笔记本上执行这句命令能致  (02月02日)
  • .NET开发必会的Linux命令  (12/20/2015 10:32:03)
  • 运维工程师必会的109个Linux命令  (03月09日)
  • 有趣的Linux命令行:随机输出唐诗  (12/28/2015 20:14:23)
  • 10 个 Linux 中的 passwd 命令示例  (10/29/2015 10:14:30)
本文评论 查看全部评论 (0)
表情: 姓名: 字数