Linux RPM Commands

Quick reference guide for common RPM (Red Hat Package Manager) commands

This post provides a quick reference guide for common RPM (Red Hat Package Manager) commands used in Linux systems.

Basic Package Operations

List installed packages:

1
rpm -qa

Install a package:

1
rpm -ivh foo-1.0-2.i386.rpm

Test installation (without actually installing):

1
rpm -ivh --test pkgname

Remove a package:

1
rpm -e foo

Upgrade a package:

1
rpm -Uvh foo-1.0-2.i386.rpm

Freshen a package (upgrade only if previous version exists):

1
rpm -Fvh pkgname

Query and Information Commands

Query a package:

1
rpm -q foo

Display package information:

1
rpm -qi foo

List files in a package:

1
rpm -ql foo

Find which package a file belongs to:

1
rpm -qf filename

Display file list and package information:

1
rpm -qfl pkgname

Package Verification

Check RPM signature:

1
rpm --checksig foo

Operation Reference Table

OperationShort OptionLong Option
Upgrade/install-U–upgrade
Install-I–install
Remove-e–erase
Query-q–query
Verify-V–verify
Check signature-K–checksig
Freshen-F–freshen
Initialize database–initdb
Rebuild database–rebuilddb

Source: Fedora RPM Guide

comments powered by Disqus

© 2025 Santosh Manoharan