Linux rpm List Installed Packages Command

last updated in Categories , , ,

How do I list all installed packages using rpm command on CentOS/Suse/Fedora/RHEL/Scientific and Red Hat Enterprise Linux? Can you tell me the Linux command to list all rpm’s installed on the server?

The rpm command is a powerful package manager. It is used to build, install, query, verify, update, and erase individual software packages on RPM based distro such as OpenSUSE, RHEL or CentOS. The latest version of Red hat and friends recommend using the yum command or dnf command.. This page explains how to list or count onstalled RPM packages on Linux operating systems.


Linux rpm list installed packages command syntax

The rpm command has -a option to query (list) all installed packages.

List all installed packages using rpm -a option

Open the Terminal or login to the remote server using ssh client. Type the following command as root user:
# rpm -qa
Sample outputs:

filesystem-2.4.0-1
comps-extras-11.1-1.1
gnome-mime-data-2.4.2-3.1
glibc-2.5-12
atk-1.12.2-1.fc6
libICE-1.0.1-2.1
db4-4.3.29-9.fc6
elfutils-libelf-0.125-3.el5
ncurses-5.5-24.20060715
libsepol-1.15.2-1.el5
libcap-1.10-26
sqlite-3.3.6-2
pcre-6.6-1.1
gdbm-1.8.0-26.2.1
libsepol-1.15.2-1.el5
libXdmcp-1.0.1-2.1
db4-4.3.29-9.fc6
iptables-1.3.5-1.2.1
libXrender-0.9.1-3.1
libXi-1.0.1-3.1
xorg-x11-font-utils-7.1-2
slang-2.0.6-4.el
.....
..
....

One can list installation date too as follows:
rpm -qa --qf '(%{INSTALLTIME:date}): %{NAME}-%{VERSION}\n
Sample outputs:

(Tuesday 17 September 2019 11:54:48 PM IST): python-jinja2-2.7.2
(Saturday 27 January 2018 08:46:16 PM IST): python-markupsafe-0.11
(Tuesday 17 September 2019 11:53:12 PM IST): nss-pem-1.0.3
(Tuesday 17 September 2019 11:54:50 PM IST): neon-0.30.0
(Tuesday 17 September 2019 11:53:12 PM IST): rpm-python-4.11.3
(Friday 21 September 2018 05:10:19 AM IST): python34-msgpack-0.5.6
(Tuesday 17 September 2019 11:54:50 PM IST): iwl6000-firmware-9.221.4.1
(Tuesday 17 September 2019 11:53:13 PM IST): make-3.82
(Wednesday 29 November 2017 12:57:00 AM IST): gettext-0.19.8.1
(Sunday 25 June 2017 07:08:26 PM IST): ppp-2.4.5
(Tuesday 17 September 2019 11:54:51 PM IST): iwl1000-firmware-39.31.5.1
(Tuesday 17 September 2019 11:53:14 PM IST): libgfortran-4.8.5
(Sunday 02 July 2017 02:11:41 AM IST): mtools-4.0.18
(Wednesday 05 December 2018 06:54:19 AM IST): radvd-2.17
(Sunday 25 June 2017 07:08:28 PM IST): alsa-firmware-1.0.28
(Tuesday 17 September 2019 11:54:53 PM IST): libgcc-4.8.5
(Thursday 10 May 2018 02:10:20 PM IST): opus-1.0.2
(Tuesday 17 September 2019 11:53:17 PM IST): passwd-0.79
(Tuesday 17 September 2019 11:54:56 PM IST): rdma-core-22.1

Getting info about specific packages

You can display more information about package using the following command:
# rpm -qi iptables
Sample outputs:

Name        : iptables                     Relocations: /usr 
Version     : 1.3.5                             Vendor: Red Hat, Inc.
Release     : 1.2.1                         Build Date: Thu 13 Jul 2006 07:17:24 PM CDT
Install Date: Tue 10 Jul 2007 08:49:20 AM CDT      Build Host: ls20-bc2-14.build.redhat.com
Group       : System Environment/Base       Source RPM: iptables-1.3.5-1.2.1.src.rpm
Size        : 676805                           License: GPL
Signature   : DSA/SHA1, Thu 18 Jan 2007 09:47:22 AM CST, Key ID 5326810137017186
Packager    : Red Hat, Inc. 
URL         : http://www.netfilter.org/
Summary     : Tools for managing Linux kernel packet filtering capabilities.
Description :
The iptables utility controls the network packet filtering code in the
Linux kernel. If you need to set up firewalls and/or IP masquerading,
you should install this package.

List all files installed by the RPM package

You can list package files using the following command:
# rpm -ql iptables
Sample outputs:

/etc/rc.d/init.d/iptables
/etc/sysconfig/iptables-config
/lib64/iptables
/lib64/iptables/libipt_CLASSIFY.so
/lib64/iptables/libipt_CONNMARK.so
/lib64/iptables/libipt_DNAT.so
/lib64/iptables/libipt_DSCP.so
/lib64/iptables/libipt_ECN.so
.....
.......
...

Feel free to add pager such as less or more to display output one screen at a time:
# rpm -qa | less
# rpm -qa | more
# rpm -qa | grep 'something'
# rpm -ql iptables | more

Want to find out the installation date of a specific package, for example nginx, run:
# rpm -q --last nginx
package nginx is not installed
# rpm -q --last ufw
ufw-0.35-9.el7.noarch Thursday 21 June 2018 11:33:26 PM IST

List installed RPM packages using yum or dnf on Linux

Run the following as the root user (use the grep command or more command as pager/filters):
# yum list installed
# yum list installed | more
# yum list installed | grep nginx

Linux rpm List Installed using rpm command
For Fedora and latest version of the CentOS/RHEL 8.x use the dnf command
# dnf list installed
# dnf list installed | less
# dnf list installed | grep -i mysql

Count all installed RPM packages using yum/dnf in Linux

Pass the yum command output to the wc command to count installed packages on CentOS or RHEL or SUSE:
# yum list installed | wc -l
# dnf list installed | wc -l

List or Count Installed RPM Packages in CentOS RHEL Suse Linux

List all installed packages in RHEL, CentOS, Oracle and Fedora Linux

Another option is to type the following rpmquery command. However, first install dnf-utils/yum-utils package:
# dnf install dnf-utils ## <-- Fedora latest or CentOS/RHEL 8x. -- ##
# yum install yum-utils ## <-- CentOS/RHEL 6.x/7.x -- ##

Next, type the following command:
# repoquery -a --installed
# repoquery -a --installed | grep httpd
# repoquery -a --installed | more

Use rpmquery command to list all installed rpm packages in Linux
It is also possible to list installed packages from a particular repo such as epel repo on CentOS/RHEL 7 or ELEP repo on RHEL 8 or EPEL repo on CentOS 8. First, get the repo id, run:
# yum repolist
Sample outputs:

Loaded plugins: changelog, copr
repo id                          repo name                                             status
base/7/x86_64                    CentOS-7 - Base                                       10,097
epel/x86_64                      Extra Packages for Enterprise Linux 7 - x86_64        13,501
extras/7/x86_64                  CentOS-7 - Extras                                        307
ngompa-snapcore-el7/x86_64       Copr repo for snapcore-el7 owned by ngompa                19
updates/7/x86_64                 CentOS-7 - Updates                                     1,010
repolist: 24,934

Note down repo id such as base, epel, extras and so on. Finally list all installed packages from epel repo:
yumdb search from_repo reop_id_here
yumdb search from_repo extras
yumdb search from_repo epel

Linux command to list rpm's installed on centos or rhel

Conclusion

In this tutorial, you learned how to list all installed rpm packages on CentOS, RHEL (Red Hat Enterprise Linux), SUSE/OpenSUSE and other rpm based distros using rpm and dnf/yum command that print a list of all installed packages on your distro. See rpm man page here.

  • Man pages: yum(8)

ADVERTISEMENTS

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

13 comment

  1. Merci beaucoup, I was just searching for that option right now!

    And if one has a lot of .rpm, it’s great to pipe it through sort and more, like this:

    rpm -qa | sort -fu | more

    then you got a nice alphabetical list that you don’t need to scroll up and down…

    Greetings from France

  2. hey ol of u’ve written how to list the installed packages, but is there a way to install a new package using rpm???????
    please help me out!!!!!!!!!!

  3. Hi! ,
    By using these commands I can’t find package which I have installed by other way, par exemple: with ‘make install’.

  4. Unless you have compiled your own rpm or installed an rpm, you will not see custom built packages in your rpm list.

  5. number of rpm installed, (just to take a count)

    [oc@150820134 ~]$ rpm -qa | wc -l
    1613
    [oc@150820134 ~]$

  6. Hi All,

    We can check the whether group packages are installed using yum grouplist | grep “Development Tools” — for example

    Is it possible to find using same using rpm

    Still, have a question? Get help on our forum!