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