RPM Commands Cheat Sheet for Linux

RPM Commands come as part of RPM Package Manager/Red Hat Package Manager is a powerful Software Package management tool used on various Package management systems like – Red Hat, Suse, Fedora Linux, Novell NetWare and IBM’s AIX. RPM is essentially a command line tool, which can be used to build, install, query, verify, update, and remove/erase individual packages.

A Package consists of an archive of files, and package information, including name, version, and description. Mainly two types of packages are managed by rpm, source packages (with extension .src.rpm) and binary packages (with extension .rpm).

Commonly used rpm commands:

Command Syntax Description Examples
rpm -ivh {rpm-file} Install the package rpm -ivh ImageMagick-6.7.8.9-10.el7.x86_64

rpm -ivh --test ImageMagick-6.7.8.9-10.el7.x86_64

rpm -Uvh {rpm-file} Upgrade package rpm -Uvh ImageMagick-6.7.8.9-10.el7.x86_64

rpm -Uvh --test ImageMagick-6.7.8.9-10.el7.x86_64

rpm -ev {package} Erase/remove/ an installed package rpm -ev ImageMagick-6.7.8.9-10.el7.x86_64
rpm -ev –nodeps {package} Erase/remove/ an installed package without checking for dependencies rpm -ev --nodeps ImageMagick-6.7.8.9-10.el7.x86_64
rpm -qa Display list all installed packages rpm -qa

rpm -qa | less

rpm -qi {package} Display installed information along with package version and short description rpm -qi ImageMagick-6.7.8.9-10.el7.x86_64
rpm -qf {/path/to/file} Find out what package a file belongs to i.e. find what package owns the file rpm -qf /etc/passwd

rpm -qf /bin/bash

rpm -qc {pacakge-name} Display list of configuration file(s) for a package rpm -qc httpd
rpm -qcf {/path/to/file} Display list of configuration files for a command rpm -qcf /usr/X11R6/bin/xeyes
rpm -qa –last Display list of all recently installed RPMs rpm -qa --last

rpm -qa --last | less

Useful References:

Feel Free to comment, if you find that some important command is missing from the list. 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami