Show all RPM packages installed and what repository they came from on RedHat or Centos

Here’s a quick linux command to show all the packages you have installed (on RPM based systems, like RHEL and Centos) and what repository they came from. NOTE: the “sort” command sorts the packages by name, and the “column” command outputs the list in a neatly formatted tab delimited display in your terminal.

$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | sort | column -t

Sample output:

$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | sort | column -t | head
acl                                  CentOS
acpid                                CentOS
alsa-lib                             CentOS
amtu                                 CentOS
anacron                              CentOS
ant                                  JPackage  Project
antlr                                JPackage  Project
apr                                  CentOS
apr                                  CentOS
apr-util                             CentOS

And if you wanted to see all packages that came from external (non-Centos) repositories:

$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | sort | column -t | grep -iv Centos

Updated: