Finding installed packages on Linux machine

Hi,

i am trying to grab all the installed packages on linux machine,and only want to grab "Name" "Version" "Release" "Vendor" information
i am using below command to do so :

 
rpm -qa --info | grep -e 'Name' -e 'Version' -e 'Release' -e 'Vendor'
 
the output contains lot other info like below:
Name        : libidn                       Relocations: (not relocatable)
Version     : 0.6.5                             Vendor: Red Hat, Inc.
Release     : 1.1                           Build Date: Thu 13 Jul 2006 08:20:40 AM BST
Summary     : Internationalized Domain Name support library
Names (IDN) working group, used for internationalized domain
Name        : libXau                       Relocations: (not relocatable)

can someone help me with script in extarcting just the name,version,release,vendor on a separate lines..

You may nee to extend your searching. Try :-

rpm -qa --info | grep -e '^Name ' -e 'Version' -e 'Release' -e 'Vendor'

Note the trailing space for Name too.

It should give you:-

Name        : libidn                       Relocations: (not relocatable)
Version     : 0.6.5                             Vendor: Red Hat, Inc.
Release     : 1.1                           Build Date: Thu 13 Jul 2006 08:20:40 AM BST
Name        : libXau                       Relocations: (not relocatable)

I'm not sure if the last line may be a problem or if that is the next entry.

I hope that this helps.

Robin
Liverpool/Blackburn
UK

1 Like

thanks ...but i got the solution..there is in built switch availabale which gives you freedom to manipulate the data representation:

rpm -qa --queryformat 'Name:%{NAME}\nVersion:%{VERSION}-%{RELEASE}\nVendor:%{VENDOR}\n'

this will give u the output as follow:

 
Name:linuxwacom
Version:0.7.8.3-11.2.el5_8
Vendor:Red Hat, Inc.
1 Like

Thanks for this. I'm happy to learn of it too. :b:

Robin