RPM - RedHad Package Manager is a very popular utility for uninstalling packages on Unix / Linux systems, most of we are using on CentOS, Red Hat, Fedora, etc. The "rpm command" usages are installing, removing, upgrading, querying, checking rpm packages on your system.

The following is an examples are how to use rpm packages.

Login as root user,


How to Install ,rpm Package:

Download the rpm package and install on your system, for an example dowload the JDK .rpm package.
# wget "http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.rpm"

# rpm -ivh jdk-7u60-linux-x64.rpm

-i  : install a package
-v : verbose
-h: Print hash marks as the package during install  can  Use with --verbose for display.

Install without dependency:

If you know very well dependencies installed in your system ignore these dependency with --nodeps,
# rpm -ivh --nodeps jdk-7u60-linux-x64.rpm

Check your installed packages:
# rpm -q openssl


Query :

 Display RPM package,

To disaplay installed rpm packages from the system.
# rpm -qa


-q : specify for query operation
-a : specify for queries all installed packages

Identify at a specifc package:

To  identify and  display specific installed package,
# rpm -qa | grep openssl


Package Information:

below command shows specific package information (openssl)
# rpm -qi openss

Name        : openssl                      Relocations: (not relocatable)
Version     : 1.0.1e                            Vendor: CentOS
Release     : 30.el6.8                      Build Date: Wednesday 01
April 2015 06:59:29 PM IST
Install Date: Wednesday 22 April 2015 08:29:29 PM IST      Build Host:
Group       : System Environment/Libraries   Source RPM:
Size        : 4222198                          License: OpenSSL
Signature   : RSA/SHA1, Wednesday 01 April 2015 07:02:01 PM IST, Key
ID 0946fca2c105b9de
Packager    : CentOS BuildSystem
URL         : http://www.openssl.org/
Summary     : A general purpose cryptography library with TLS implementation
Description :
The OpenSSL toolkit provides support for secure communications between
machines. OpenSSL includes a certificate management tool and shared
libraries which provide various cryptographic algorithms and

Package Information Before Installation:

Also, we can get package information before installation on your system,
# rpm -qip  bc-1.06-21.i386.rpm

warning: bc-1.06-21.i386.rpm: Header V3 DSA/SHA1 Signature, key ID
e8562897: NOKEY
Name        : bc                           Relocations: (not relocatable)
Version     : 1.06                              Vendor: CentOS
Release     : 21                            Build Date: Tuesday 30
January 2007 07:37:54 PM IST
Install Date: (not installed)               Build Host: builder4.centos.org
Group       : Applications/Engineering      Source RPM: bc-1.06-21.src.rpm
Size        : 187904                           License: GPL
Signature   : DSA/SHA1, Wednesday 04 April 2007 05:50:21 AM IST, Key
ID a8a447dce8562897
URL         : http://www.gnu.org/software/bc/
Summary     : GNU's bc (a numeric processing language) and dc (a calculator).
Description :
The bc package includes bc and dc. Bc is an arbitrary precision
numeric processing arithmetic language. Dc is an interactive
arbitrary precision stack based calculator, which can be used as a
text mode calculator.

Install the bc package if you need its number handling capabilities or
if you would like to use its text mode calculator.

  -i : Specify for view information about an rpm
  -p : specify a package name

How to Query documentation of Installed RPM Package:
​# rpm -qdf /usr/bin/openssl


List of package files :

The below command show list out the files without installing into the local directory folder.
# rpm -qlp bc-1.06-21.i386.rpm

warning: bc-1.06-21.i386.rpm: Header V3 DSA/SHA1 Signature, key ID
e8562897: NOKEY

    q : specify to query the rpm file
    l  : specifiy to list the files in the package
    p : specify the package name

Shows Dependency Packages:
#  rpm -qRp bc-1.06-21.i386.rpm

warning: bc-1.06-21.i386.rpm: Header V3 DSA/SHA1 Signature, key ID
e8562897: NOKEY
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1

Upgrade :

Upgrade package :

Would you like to upgrade specific package use -Uvh option,
# rpm -Uvh bc-1.06-21.i386.rpm

Uninstalling :

Remove /  Uninstalling package:

We can remove or uninstalling specific package and dependency package with -e option 
# rpm -e openssl-1.0.1e-30.el6.8.x86_64

How To rebuild Corrupted RPM Database
# cd /var/lib

# rm __db*

# rpm --rebuilddb

# rpmdb_verify Packages​