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 and would like to help support this site - and get something for yourself - sign 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: 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: Looking to start investing some of your saved income? Get started by opening an account with Webull, where upon sign-up and opening a brokerage account with an initial deposit of $100 or more you will receive free stock(s). The promotions are always changing, so be sure to click the link to see the latest.

Thanks for reading and take care.