This is a simple cheatsheet for the rpm command and can be used on systems like RedHat that uses the command
|
Syntax
|
<th>
<strong>Description</strong>
</th>
<th>
<strong>Example(s)</strong>
</th>
|
rpm -ivh {rpm-file}
|
<td>
Install the package
</td>
<td>
rpm -ivh sendmail-cf-8.14.2-1.fc8.rpm<br /> rpm -ivh –test sendmail-8.14.2-1.fc8.rpm
</td>
|
rpm -Uvh {rpm-file}
|
<td>
Upgrade package
</td>
<td>
rpm -Uvh sendmail-cf-8.14.2-1.fc8.rpm<br /> rpm -Uvh –test sendmail-8.14.2-1.fc8.rpm
</td>
|
rpm -ev {package}
|
<td>
Erase/remove/ an installed package
</td>
<td>
rpm -ev sendmail
</td>
|
rpm -ev –nodeps {package}
|
<td>
Erase/remove/ an installed package without checking for dependencies
</td>
<td>
rpm -ev –nodeps sendmail
</td>
|
rpm -qa
|
<td>
Display list all installed packages
</td>
<td>
rpm -qa<br /> rpm -qa | less
</td>
|
rpm -qi {package}
|
<td>
Display installed information along with package version and short description
</td>
<td>
rpm -qi sendmail
</td>
|
rpm -ql {package-name}
|
<td>
List files in package
</td>
<td>
rpm -ql sendmail
</td>
|
rpm -qf {/path/to/file}
|
<td>
Find out what package a file belongs to i.e. find what package owns the file
</td>
<td>
rpm -qf /etc/passwd<br /> rpm -qf /bin/bash
</td>
|
rpm -qc {pacakge-name}
|
<td>
Display list of configuration file(s) for a package
</td>
<td>
rpm -qc httpd
</td>
|
rpm -qcf {/path/to/file}
|
<td>
Display list of configuration files for a command
</td>
<td>
rpm -qcf /usr/bin/locate
</td>
|
rpm -qa –last
|
<td>
Display list of all recently installed RPMs
</td>
<td>
rpm -qa –last<br /> rpm -qa –last | less
</td>
rpm -qpR {.rpm-file} rpm -qR {package}
|
<td>
Find out what dependencies a rpm file has
</td>
<td>
rpm -qpR sendmail-8.14.2-1.fc8.rpm<br /> rpm -qR bash
</td>
|
rpm –test {package}
|
<td>
Perform Installation Tests Only
</td>
<td>
rpm -i –test rpm-2.0.11-1.i386.rpm<br /> /bin/rpm conflicts with file from rpm-2.3-1<br /> /usr/bin/gendiff conflicts with file from rpm-2.3-1<br /> /usr/bin/rpm2cpio conflicts with file from rpm-2.3-1<br /> /usr/bin/rpmconvert conflicts with file from rpm-2.3-1<br /> /usr/man/man8/rpm.8 conflicts with file from rpm-2.3-1<br /> error: rpm-2.0.11-1.i386.rpm cannot be installed
</td>
|
rpm –replacepkgs
|
<td>
Install the Package Even If Already Installed. Is used to force RPM to install a package that it believes to be installed already. This option is normally used if the installed package has been damaged somehow and needs to be fixed up.
</td>
<td>
</td>