rpm

From RaySoft

rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages.[1]

Documentation

Parameters

General parameters
These options can be used in all the different modes.
-v, --verbose
Print verbose information - normally routine progress messages will be displayed.
-e PACKAGE, --erase PACKAGE
Remove installed the PACKAGE.
-q, --query
Query the rpm database.
-a, --all
Query all installed packages.
-f FILE, --file FILE
Query package owning FILE.
-U PACKAGE, --upgrade PACKAGE
This upgrades or installs the PACKAGE currently installed to a newer version.
-h, --hash
Print 50 hash marks as the package archive is unpacked. Use with -v for a nicer display.

Examples

Get all installed kernel versions
rpm -qa | grep 'kernel'
Get the package where the file is installed from
rpm -qf '/usr/sbin/rhn_register'
rhn-setup-0.4.17-8.el5
Force reinstallation of a package
rpm -e --justdb --nodeps 'xterm.x86_64'
yum install 'xterm.x86_64'
Force reinstallation of all installed packages
yum list installed | while read -r -a package; do
   rpm -e --justdb --nodeps "${package[0]}"
   yum install "${package[0]}"
done

References

  1. man 8 'rpm'