RPM cheat sheet

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.

DescriptionSyntax
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

DescriptionExample(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 rpm -qcf /usr/bin/foo.bin
Display list of all recently installed RPMs rpm -qa --last
Find dependencies the foo RPM file has rpm -qpR foo-1.0-1.i386.rpm rpm -qR foo
Verify all RPM packages rpm -Va