Root
RPM Cheat Sheet

RPM Cheat Sheet

If you have to deal with RPM files, here are some convenient commands I've stumbled across.

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

If RPM is borked, read this:

  http://www.rpm.org/hintskinks/repairdb/

This is https://michal.guerquin.com/rpmcheatsheet.html, updated 2006-02-03 12:49 EST

Contact: michalg at domain where domain is gmail.com (more)