RPM command explained in CentOS/RHEL/Fedora

RPM: Redhat Package Manager
RPM command is used for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Linux system.

RPM command syntax
Command option argument
Example:
rpm -qa package_name

RPM help command
rpm --help
or
man rpm

Options are:
i- Install a package
v- Verbose
h-  Hash mode
q - Query
a-  all
U-  Upgrade a package
-e- Erase package
-ivh – Install rpm package
-ivh –nodeps – Install rpm package without dependencies
-Uvh – Upgrade a rpm package
-ev --nodeps - Uninstall package without checking of dependency
-qi - Display information about package, version
-qf -Query package name for a file(/etc/passwd)
-qc - Query configuraiton name of package
-ql – List all the files of a package
-qd - Query doc file
-qa --last              - Query all recently installed RPMs package
-qR  -  Find out what dependencies a rpm file has

Download rpm package from Website http://rpmfind.net
1. How to find out what are the packages are installed in system
#rpm -qa
#rpm -qa bash
or,
#rpm -qa | grep bash
#rpm -qa | less


2. How to install a package in system
#rpm -qa vsftpd
#rpm -ivh package name
Example:
#rpm -ivh vsftpd
or,
#rpm -Uvh vsftpd
#rpm -qa vsftpd

How to uninstall/remove/erase a package
#rpm -e vsftpd
How to find what package a file belongs to
# rpm -qf /etc/passwd

Verifying all the RPM installed Packages
# rpm -Va