Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am working on 64 bits RHEL and I want rpm -q to use these tags by default:

'%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}'

Other than typing the tags by hand or defining an alias, is there a way I can configure this in ~/.rpmrc or another config file?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

The %_query_all_fmt macro defines what format is used. Set it in ~/.rpmmacros.

%_query_all_fmt %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}
share|improve this answer
    
Works great, thanks! Before I accept your answer, can you please tell me where you found this? I searched for the answer but couldn't find it. Thanks! –  Philippe A. Jul 28 '10 at 17:56
    
I can't remember. I've been using rpm for... about a decade, and it's one of the things I picked up along the way. Anyways, rpm --showrc is your friend. –  Ignacio Vazquez-Abrams Jul 28 '10 at 17:59

I found below output most practical:

rpm -q --qf \
    '%{name}-%|epoch?{%{epoch}:}:{}|%{version}-%{release}%|arch?{.%{arch}}:{}|\n'

in ~/.rpmmacros you can skip adding \n at the end of the format. Basically it skips displaying %{epoch} or %{arch} if package doesn't have it set. For example see output of rpm -q tar openssl bind-libs perl-CGI gpg-pubkey on Scientific Linux 6.2.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.