rpm Commands Cheat Sheet


The yum command, and now the newer dnf command, typically provide all of the functionality needed to manage packages on RPM-based Linux distributions. However, sometimes you just need to use the rpm command to fix a problem or get a piece of information about a package yum or dnf might not provide.

List all installed packages

rpm -qa

What package provides a particular binary

rpm -q -f /path/to/binary

For example:

rpm -q -f /bin/mail

yum provides is the equivalent.

Extract Source RPM

rpm2cpio $RPM | cpio -idmv

List package info

yum info is the equivalent, but rpm will provide more information.

For installed packages

rpm -qi $PACKAGE_NAME

For not installed packages

rpm -qpi $PACKAGE_NAME

List of files installed by package

For installed packages

rpm -ql $PACKAGE_NAME

For not installed packages

rpm -qpl $PACKAGE_NAME

List configuration files for package

For installed packages

rpm -q --configfiles $PACKAGE_NAME

Or, with the shorthand command line switch:

rpm -qc $PACKAGE_NAME

For not installed packages

rpm -qp --configfiles $PACKAGE_NAME

Or, with the shorthand command line switch:

rpm -qpc $PACKAGE_NAME

List documentation/man pages for package

For installed packages

rpm -q --docfiles $PACKAGE_NAME

Or, with the shorthand command line switch:

rpm -qd $PACKAGE_NAME

For not installed packages

rpm -qp --docfiles $PACKAGE_NAME

Or, with the shorthand command line switch:

rpm -qpd $PACKAGE_NAME

List of shell scripts that may run after package is installed/uninstalled

For installed packages

rpm -q --scripts $PACKAGE_NAME

If you found this post useful, you can help support this site and get something for yourself by signing up for any of the services listed below through the provided links.

The following links are part of affiliate programs, and I will receive a referral payment from any of the services you sign-up for.

  • Get Faster Shipping: Perhaps you're about to order some stuff on Amazon but want to get more value out of the money you would normally pay for shipping. Sign-up for a free, 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.
  • Start Investing Now: Are you looking to start investing some of your disposable saved income? Get started by opening an account with Webull, where upon sign-up and opening a brokerage account with an initial deposit of at least $100 you will receive 1 stock valued (subject to change based on normal market movement) between $8 and $1600.

Thanks for reading and take care.