Useful RPM Commands

RPM package is a powerful utility for managing the software packages of major Linux distributions. RPM can be used to install and remove software packages, update packages and get an overview of all installed packages.

Here are some useful commands to manipulate RPM packages:

== Query / Verify commands

Getting detailed information about the package wget:

rpm -qi wget

Determining which package installed the file /usr/bin/wget:

rpm -qf /usr/bin/wget

Showing all the files installed by the package wget:

rpm -ql wget

Viewing the documentation files for the command wget:

rpm -qd wget

Listing all files included in the not yet installed package wget by entering the following:

rpm -qpl /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

Listing all files included in the installed package wget:

rpm -ql wget

Verifying that a package is no longer installed by entering:

rpm -qa | grep wget

Seeing what has changed in the files on your hard drive since the wget RPM was originally installed by entering the following:

rpm -V wget

Checking package to ensure its integrity and origin: (NOTE: gpg or pgp software must be installed on your system before you use this command)

rpm -K /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

== Install / Uninstall / Upgrade commands

Installing the package wget:

rpm -ivh /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

Uninstalling the package wget:

rpm -e wget

Upgrading the package wget: (NOTE: if the package is not installed it will install it for You, like option "-ivh")

rpm -Uvh /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

Extracting RPM file using rpm2cpio and cpio command: (NOTE: RPM content will be extracted the current directory)