📄 0053-0056.html
字号:
<HTML>
<HEAD>
<TITLE>Maximum RPM (RPM):Getting Information About Packages:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311054 //-->
<!-- TITLE=Maximum RPM (RPM)//-->
<!-- AUTHOR=Edward Bailey//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=05 //-->
<!-- PAGES=0053-0078 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch04/0052-0052.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0057-0059.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-53"><P>Page 53</P></A>
<H3><A NAME="ch05_ 1">
Chapter 5
</A></H3>
<H2>
Getting Information <BR>
About Packages
</H2>
<A NAME="PAGENUM-54"><P>Page 54</P></A>
<P>Table 5.1. Query-mode command syntax and options.
</P>
<TABLE>
<TR><TD>
rpm -q (or --query)
</TD><TD>
<B>Options</B>
</TD><TD>
</TD></TR><TR><TD>
<B>Package Selection Options
</TD><TD>
Section</B>
</TD><TD>
pkg1...pkgN
</TD></TR><TR><TD>
Query installed package(s)
</TD><TD>
5.2.1.1
</TD><TD>
-p <file> (or -)
</TD></TR><TR><TD>
Query package file <file> (URLs are usable)
</TD><TD>
5.2.1.4
</TD><TD>
-f <file>
</TD></TR><TR><TD>
Query package owning
<file>
</TD><TD>
5.2.1.3
</TD><TD>
-a
</TD></TR><TR><TD>
Query all installed packages
</TD><TD>
5.2.1.2
</TD><TD>
--whatprovides <x>
</TD></TR><TR><TD>
Query packages providing capability
<x>
</TD><TD>
5.2.1.6
</TD><TD>
-g <group>
</TD></TR><TR><TD>
Query packages belonging to group
<group>
</TD><TD>
5.2.1.5
</TD><TD>
--whatrequires <x>
</TD></TR><TR><TD>
Query packages requiring capability
<x>
</TD><TD>
5.2.1.7
</TD><TD>
</TD></TR><TR><TD>
Information Selection Options
</TD><TD>
Section
</TD><TD>
<null>
</TD></TR><TR><TD>
Display full package label
</TD><TD>
5.2.2
</TD><TD>
-i
</TD></TR><TR><TD>
Display summary package information
</TD><TD>
5.2.2.1
</TD><TD>
-l
</TD></TR><TR><TD>
Display list of files in package
</TD><TD>
5.2.2.2
</TD><TD>
-c
</TD></TR><TR><TD>
Display list of configuration files
</TD><TD>
5.2.2.4
</TD><TD>
-d
</TD></TR><TR><TD>
Display list of documentation files
</TD><TD>
5.2.2.5
</TD><TD>
-s
</TD></TR><TR><TD>
Display list of files in package, with state
</TD><TD>
5.2.2.6
</TD><TD>
--scripts
</TD></TR><TR><TD>
Display install, uninstall, verify scripts
</TD><TD>
5.2.2.10
</TD><TD>
--queryformat (or --qf)
</TD></TR><TR><TD>
Display queried data in custom format
</TD><TD>
5.2.2.11
</TD><TD>
--dump
</TD></TR><TR><TD>
Display all verifiable information for each file
</TD><TD>
5.2.2.9
</TD><TD>
--provides
</TD></TR><TR><TD>
Display capabilities package provides
</TD><TD>
5.2.2.7
</TD><TD>
--requires (or -R)
</TD></TR><TR><TD>
Display capabilities package requires
</TD><TD>
5.2.2.8
</TD><TD>
</TD></TR><TR><TD>
General Options
</TD><TD>
Section
</TD><TD>
-v
</TD></TR><TR><TD>
Display additional information
</TD><TD>
5.2.2.3
</TD><TD>
-vv
</TD></TR><TR><TD>
Display debugging information
</TD><TD>
5.2.3
</TD><TD>
--root <path>
</TD></TR><TR><TD>
Set alternate root to <path>
</TD><TD>
5.2.4
</TD><TD>
--rcfile <rcfile>
</TD></TR><TR><TD>
Set alternate rpmrc file to <rcfile>
</TD><TD>
5.2.5
</TD><TD>
--dbpath <path>
</TD></TR><TR><TD>
Use <path> to find the RPM database
</TD><TD>
5.2.6
</TD></TR></TABLE>
<A NAME="PAGENUM-55"><P>Page 55</P></A>
<H3><A NAME="ch05_ 2">
5.1. rpm -q: What Does It Do?
</A></H3>
<P>One of the nice things about using RPM is that the packages you manage don't end up
going into some kind of black hole. Nothing would be worse than to install, upgrade, and erase
several different packages and not have a clue as to what's on your system. In fact, RPM's
query function can help you get out of sticky situations such as the following:
</P>
<UL>
<LI> You're poking around your system and you come across a file that you just
can't identify. Where did it come from?
<LI> Your friend sends you a package file and you have no idea what the package
does, what it installs, or where it originally came from.
<LI> You know that you installed XFree86 a couple months ago, but you don't know
what version and you can't find any documentation on it.
</UL>
<P>The list could go on, but you get the idea. The
rpm -q command is what you need. If you're the kind of person who doesn't like to have more options than you know what to do with,
rpm -q might look imposing. But fear not. Once you have a handle on the basic structure of an
RPM query, it'll be a piece of cake.
</P>
<H3><A NAME="ch05_ 3">
5.2. The Parts of an RPM Query
</A></H3>
<P>It becomes easy to construct a query command when you understand the individual parts.
First is the -q (you can also use --query, if you like). After all, you need to tell RPM what
function to perform, right? The rest of a query
command consists of two distinct parts: package
selection (or what packages you'd like to query) and information selection (or what
information you'd like to see). Let's take a look at package selection first.
</P>
<H4><A NAME="ch05_ 4">
5.2.1. Query Commands, Part I: Package Selection
</A></H4>
<P>The first thing you'll need to decide when issuing an RPM query is what package (or
packages) you'd like to query. RPM has several ways to specify packages, so you have quite an
assortment to choose from.
</P>
<B>
5.2.1.1. The Package Label
</B>
<P>Earlier chapters discuss RPM's package label, a string that uniquely identifies every
installed package. Every label contains three pieces of information:
</P>
<UL>
<LI> The name of the packaged software
<LI> The version of the packaged software
<LI> The package's release number
</UL>
<A NAME="PAGENUM-56"><P>Page 56</P></A>
<P>When issuing a query command using package labels, you must always include the
package name. You can also include the version and even the release, if you like. The only
restrictions are that each part of the package label specified must be complete and that if
any parts of the package label are missing, all parts to the right must be omitted as well. This second
restriction is just a long way of saying that if you specify the release, you must specify the version as
well. Let's look at a few examples.
</P>
<P>Say, for instance, you've recently installed a new version of the C libraries, but you can't
remember the version number:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -q libc
libc-5.2.18-1
#
</PRE>
<!-- END CODE SNIP //-->
<P>In this type of query, RPM returns the complete package label for all installed packages
that match the given information. In this example, if version 5.2.17 of the C libraries were
also installed, its package label would have been displayed, too.
</P>
<P>In this example, we've included the version as well as the package name:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -q rpm-2.3
rpm-2.3-1
#
</PRE>
<!-- END CODE SNIP //-->
<P>Note, however, that RPM is a bit picky about specifying package names. Here are some
queries for the C library that won't work:
</P>
<!-- CODE //-->
<PRE>
# rpm -q LibC
package LibC is not installed
#
# rpm -q lib
package lib is not installed
#
# rpm -q "lib*"
package lib* is not installed
#
# rpm -q libc-5
package libc-5 is not installed
#
# rpm -q libc-5.2.1
package libc-5.2.1 is not installed
#
</PRE>
<!-- END CODE //-->
<P>As you can see, RPM is case sensitive about package names and cannot match partial
names, version numbers, or release numbers. Nor can it use the wildcard characters we've come
to know and love. As we've seen, however, RPM can perform the query when more than
one field of the package label is present. In this case,
rpm -q libc-5.2.18, or even rpm -q libc-5.2.18-1 would have found the package,
libc-5.2.18-1.
</P>
<P><CENTER>
<a href="../ch04/0052-0052.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0057-0059.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -