RPM Examples
List all installed rpms:
$ rpm -qa
List rpm owning
file:
$ rpm -qf
file
$ rpm -qf /sbin/ifconfig
List files installed by an rpm:
$ rpm -ql
rpmQuery an rpm file instead of an installed rpm:
$ rpm -qp
rpmfile (other options)
Get a description of an rpm:
$ rpm -qip
rpmfileYou can combine options; for example, return the description and file list for the rpm which owns /sbin/ifconfig:
$ rpm -qilf /sbin/ifconfig
You can use cpio to extract the contents of RPMs. This will extract the contents of the RPM treating the current directory as the "root" directory:
$ rpm2cpio
rpmfile | cpio -idmv
Local RPM Building:
$ mkdir ~/rpms
$ cd ~/rpms
$ mkdir BUILD RPMS SOURCES SPECS SRPMS tmp
Contents of ~/.rpmmacros
%_topdir /home/username/rpms
%_tmppath /home/username/rpms/tmp