RPM Cheat Sheet

To see what you have installed:

rpm -qa | less
rpm -qa --qf "%{NAME}\n" | less  # will skip package version numbers -- useful for diffing installed rpms on different systems

To see what files a package has installed, try this:

rpm -q -l foo

foo is the name of the package as reported by rpm -qa.

If you have a .rpm file and want to see what is inside, try this:

rpm -q -lp file.rpm

To extract files from a .rpm file into current directory:

rpm2cpio file.rpm | cpio -idv

To install a package:

rpm -ihv file.rpm

To see what package a file belongs to:

rpm -q -f /some/path/to/file

To uninstall (“erase”) a package named foo:

rpm -e foo

To see disk packages by disk usage, try:

rpm -qia|awk '$1=="Name" { n=$3} $1=="Size" {s=$3} $1=="Description" {print s  " " n }' |sort -n +0|less