This article hasn't been updated for over 5 years. The information below could be outdated.
RPM cheat sheet
Updated Read time 1 min 29 sec(s) (3086 views).
Linux
RPM is a powerful package mnager available on Red Hat, Suse and Fedora Linux. It can be used to build, install, query, verify, update, and remove/erase individual software packages.
Syntax
Here is a syntax of some common RPM commands I find useful. Some of them can only be run from a root user.
Description
Syntax
Install package
rpm -i rpm-file
Install verbose with a progress bar
rpm -ivh rpm-file
Extra verbose installation
rpm -ivvh rpm-file
Uninstall
rpm -e package-name
Uninstall verbose
rpm -ev package-name
Uninstall with extra verbose
rpm -evv package-name
Upgrade
rpm -Uvh rpm-file
List installed packages
rpm -qa
List files in an rpm
rpm -qpl rpm-file
List files for an installed package
rpm -ql package-name
List documentation/man pages for package
rpm -qd package-name
rpm-file — Replace with actual rpm file
package-name — Replace with actual package name
Miscellaneous flags
Getting help
rpm --help
Verbose mode
-v
Debug/Extra-verbose mode
-vv
Progress bar with hash marks
-h
Examples
Description
Example(s)
Install the package foo
rpm -ivh foo-1.0-1.i386.rpm
Upgrade foo package
rpm -Uvh foo-1.0-1.i386.rpm
Remove the installed foo package
rpm -ev foo
Remove installed foo package without checking for dependencies
rpm -ev --nodeps foo
List all installed packages
rpm -qa
Display information, version and short description for installed foo package
rpm -qi foo
Find which package a file belongs to
rpm -qf /usr/bin/foo
rpm -qf /usr/lib/foor.bar
Display list of configuration file(s) for foo package
rpm -qc foo
Display list of configuration files for the foo.bin command