rpm -qa and architecture info

C Linus Hicks linush at verizon.net
Sun Mar 28 20:42:28 UTC 2010


On Thu, 2010-03-25 at 18:51 +0100, Dag Wieers wrote:
> On Tue, 9 Mar 2010, Yong Huang wrote:
> 
> > `rpm -qa' shows the package names (and versions and releases). This command
> >
> > rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n'
> >
> > shows that plus architecture. Is there a shorter command that does the same, i.e. shows name, version, release and arch? It's hard to remember and type that long line. I want something like
> >
> > rpm -qa [a simple option that shows arch IN ADDITION TO what the preceding option i.e. -qa shows]
> 
> Hi Yong,
> 
> What I often do is create a file called /etc/rpm/macros.query_all_fmt and 
> add the following content:
> 
>  	%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}
> 
> This will automatically show the architecture in a way that is compatible 
> with yum if you do rpm -qa.
> 
> This, however, will break any programs that does not specifically 
> provide a query format and somehow expects the default output (without 
> architecture).
> 
> To be honest, I think the current default is a design bug. Not specifying 
> an architecture results in non-unique output and causes confusion with 
> users.

You can also do the same thing per user, if you prefer.

Create or add to /home/<user>/.rpmmacros with same line as above:

%_query_all_fmt              %%{name}-%%{version}-%%{release}.%%{arch}





More information about the redhat-list mailing list