Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > AS/ES/WS Basics > Issue <<  833 of 894 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 12721
Last update: 05-13-08
Issue:
How do you make the rpm -q display arch information by default?
Resolution:

A rpm is a package manager that can be used to build, install, query, verify, update, and erase individual software packages.

When rpm is ran with options -q or --query, it will print the names of the packages queried, provided it is installed on the system. The format of the names displayed depends on the QUERYFMT format string. The QUERYFMT format strings specify a format that package information should be printed on. By default, it will print the software name, software version, and package release. The package release consists of the release version, and distribution name.

For example, using the following command on a 64-bit machine:

$ rpm -q zlib zlib-1.2.3-14.fc8
zlib-1.2.3-14.fc8

Displayed are the zlib packages installed. The software name is zlib, software version is 1.2.3, release version is 14, and the distribution name is fc8. It does not look obvious why there are two zlib packages installed. To display the architecture, either change the QUERYFMT format string each time the command rpm -q is run.

$ rpm -q --queryformat="%{name}-%{version}-%{release}.%{arch}\n" zlib
zlib-1.2.3-14.fc8.x86_64
zlib-1.2.3-14.fc8.i386

Or modify the %_query_all_fmt variable in ~/.rpmmacros.

$ echo %_query_all_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH} >> ~/.rpmmacros
$ rpm -q zlib
zlib-1.2.3-14.fc8.x86_64
zlib-1.2.3-14.fc8.i386


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > AS/ES/WS Basics > Issue <<   833  of  894  >>