Sunday, August 26, 2012

Listing Installed Packages on Linux

NOTE: First, let me mention that, unless otherwise indicated, when I blog about Linux it will be about the RPM-based distributions that are certified with the Oracle Database (RedHat Enterprise Linux, Oracle Enterprise Linux).

Normally, when you're looking to see which packages are installed on Linux (RedHat, Oracle, CentOS), you would use this command:

rpm -qa

Unfortunately, the standard output of that command omits alot of useful information. It may or may not indicate if you have the 32 or 64 bit version of a package installed, for example.

So, for a command that will show you which packages are installed in a format that looks like the name of the RPM file:

rpm -qa --queryformat \
"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm\n" |\
sort > pkglist_`date +%Y%m%d-%H%M`.txt

James

No comments:

Post a Comment