can someone really explain to me what rpm command does in linux

Dani AI

Generated

Short answer: rpm is the low‑level tool that reads and manipulates .rpm package files and the local RPM database (usually under /var/lib/rpm). It can install, upgrade, remove, query and verify packages, but it does not resolve dependencies or talk to repositories — front‑ends do that.

As said, rpm is the base Red‑Hat Package Manager; as and pointed out, day‑to‑day installs from repos are easier with a front end (yum, dnf, zypper, YaST). As noted, rpm is also useful for integrity checks and for querying package metadata when you need a precise, low‑level answer.

Common, practical rpm commands:

# list all installed packages
rpm -qa

# show info about an installed package
rpm -qi packagename

# list files installed by a package
rpm -ql packagename

# find which package owns a file
rpm -qf /path/to/file

# install or upgrade a local RPM file (verbose + progress)
rpm -Uvh package.rpm

# remove a package
rpm -e packagename

# verify installed package files (shows changed files)
rpm -V packagename

# check a .rpm file's GPG signature
rpm --checksig package.rpm

# rebuild a corrupted/locked RPM DB
rpm --rebuilddb

Quick tips and cautions: prefer yum/dnf/zypper for repo installs so dependencies are resolved automatically (e.g., dnf install package.rpm or yum localinstall package.rpm on older systems). Avoid --nodeps/--force unless you understand the consequences. If you get database lock errors, check for a running package manager/PackageKit process before forcing fixes. Use rpm queries (-qf, -ql, -qi, -qa) for troubleshooting which files came from which package and to confirm package provenance.

Recommended Answers

All 4 Replies

The rpm command is the Red-Hat Package Manager - the package management system used by Red-Hat Enterprise Linux, Fedora, CentOS, OpenSuse and many other GNU/Linux distros.
rpm is used to build, install, update, query and/or remove software packages which are packaged in Red-Hats .rpm format.

I have to admit, I mainly use debian based distros which use the debian .deb package format (or Arch, which has it's own package format). I haven't used any distros which use rpm for a few years, so I'm a little rusty with the rpm command myself!

But there's a handy cheat-sheet for using rpm here:
http://www.cyberciti.biz/howto/question/linux/linux-rpm-cheat-sheet.php

With current distributions that use the RPM format there are better front-ends for installing packages so that dependencies will be properly accounted for and installed if necessary. For Red Hat distributions (RHEL and Fedora, Scientific Linux, CentOS, Oracle Linux) you would use the yum command (YUM == Yellowdog Update Manager). For OpenSuse or Suse and related distributions you would use yast (I don't know what that stands for).

: True, yum and yast are far more convenient for maintaining rpm based systems. I meant to mention them in my previous post. But I ran out of time, so I posted what I had. After all, it seemed to answer the OPs question...ish! Heh heh! :)

When I ran last ran Fedora (back when I first started using Linux), I only ever used the rpm command when I had to manually install a package I'd downloaded from elsewhere. The rest of the time I used yum like any other sane person would! I imagine trying to use nothing but rpm for package management would be a nightmare! XD

BTW: I think yast stands for 'Yet Another Setup Tool'... Something like that!

RPM predated YUM and is not used as much. You can use it to install a rpm you have downloaded. Yum will go for the repo not the downloaded file. rpm can also be used to verify the binaries. Lets say you think someone may have gotten onto your system and messed with httpd AKA Apache2 rpm -Vf httpd Will let you know if the package matches the sum from the repo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.