Get 50% Discount Offer 26 Days

Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3
How to Use the rpm Command: Syntax, Options, and Examples

The rpm (Red Hat Package Manager) command is essential for managing software packages in RPM-based Linux distros like Red Hat Enterprise Linux (RHEL), Fedora, and CentOS. This guide will show you how to use the rpm command, covering syntax, standard options, and practical examples. Whether installing, querying, or verifying packages, this guide will help you navigate everything.

1. What Is the rpm Command?

The rpm command is a package management tool for managing software in .rpm (RPM Package Manager) format. It allows users to handle packages such as installing, querying, updating, verifying, and removing software.

Why use RPM?

  • Provides correct package installations.
  • Provides detailed package metadata for system auditing.
  • Validates software integrity and authenticity.
  • Handles software upgrades and removals seamlessly.

2. How to Use the Basic Syntax of the rpm Command

The fundamental syntax for the rpm command is:

rpm [OPTION] PACKAGE_NAME
  • rpm: Invokes the package manager.
  • [OPTION]: Defines the desired operation (e.g., install, query, verify).
  • PACKAGE_NAME: The name of the RPM package or file.

3. Key Features and Benefits of rpm

The rpm command offers several features tailored for many software:

  •  You need to install the software
    Install packages locally or from remote sources.
  •  You want to verify system integrity.
    Detects tampered or corrupted files with signature checks.
  •  You need package details
    Query installed packages or their metadata for auditing purposes.
  •  It would be best if you had an upgrade
    Quickly update or downgrade packages while retaining system stability.

4. How to Use Commonly Used Options

4.1 How to Query Installed Packages

You can query installed packages to check for specific software, list everything installed, or verify details about a particular package. For example, to check if a specific package is installed, use 

rpm -q PACKAGE_NAME
Terminal Command to Check for Installed Package Using RPM

To view a complete list of all software packages installed on your system, you can use

rpm -qa

This command queries the RPM database and outputs the names of all installed packages. It’s beneficial for system audits, troubleshooting, or verifying which applications are currently installed.

you could use "Terminal Command to List Installed Python Packages Using RPM
  • Get detailed information about a package:

To retrieve in-depth details about a specific package installed on your system, use the command

rpm -qi PACKAGE_NAME

This command provides details about the package, including its name, version, date of release, installation, size, summary, and description. It is useful when you require confirmation on the source of specific packages, enlightenment on the function of a specific package, or help when facing problems with any package.

Terminal Output Showing Package Details Using RPM

4.2 How to Install RPM Packages in Linux

Installing software is the primary function of the rpm package manager. 

  • Basic package installation:

By using the command 

rpm -i PACKAGE_FILE.rpm

You can easily install new software packages on your system. The—i flag specifies installation, and you can add options like—v for detailed feedback and—h for progress markers, making the process user-friendly and transparent. This functionality confirms that installing software is efficient and manageable, even for complex packages.

Terminal Command to Install RPM Package Using -i Flag

Install with progress and verbose output:

To install a software package while monitoring the progress and getting detailed feedback, use

rpm -ivh PACKAGE_FILE.rpm

The—i flag installs the package,—v enables verbose output, and—h displays hash marks to indicate progress. This combination provides clear visibility of the installation process, helping users identify any issues and better understand what happens during the operation. It is beneficial for tracking large or critical installations.

Terminal Command to Install RPM Package with Progress and Verbose Output

4.3 How to Verify Packages

Verifying packages is essential to confirm if they were installed correctly and have not been altered. 

Verify package integrity:

Use the command

rpm -V PACKAGE_NAME

Perform a package consistency check, which verifies all the files of the installed packages against their original state and shows missing files, changed permissions, or any other modification. Verifying the assets is also mandatory within this type of atmosphere to ensure system security and prevent adverse changes to packages and other vulnerabilities.

4.4 How to Remove Packages

Removing unused or problematic packages is very simple with rpm.

 Remove a package:

To uninstall a package that is no longer needed or causing issues, use

rpm -e PACKAGE_NAME

The—e flag stands for “erase,” ensuring the specified package is removed from your system. This command helps free up disk space, resolve software conflicts, or clean up unused applications. The simple command confirms that the associated files and entries in the RPM database are correctly deleted.

Terminal Command to Uninstall Package Using RPM

5. How to Handle Advanced Packages with rpm

5.1  Handle Dependency Issues

When a package requires specific dependencies, rpm will alert you if they are missing. You can preemptively check dependencies.

 List package dependencies:

To identify the dependencies required by a package before installation, use

rpm -qpR PACKAGE_FILE.rpm

The—q flag queries the package,—p specifies a package file (not yet installed), and -R lists all dependencies. Missing dependencies can be annoying. Thus, this command can be very handy in that you will be prompted to install what supporting packages in advance. Before making the installation, dependencies will be resolved, and possible mistakes will be avoided.

5.2  Verify Package Integrity

For security-consciousness, validate a package’s authenticity using cryptographic signatures.

 Check the signature of a package:

Validate the cryptographic signature of the package using

rpm --checksig PACKAGE_FILE.rpm

This process approves whether a trusted source signed the package and whether it was not altered. It protects your system from potentially malicious or modified software versions by ensuring only the exact package defined is installed, thus requiring security-conscious users to adhere.

Terminal Command to Verify Package Signature with RPM

5.3  View Installed Files

To confirm what files a package has installed:

List files from an installed package:

To view all files installed by a specific package, use

rpm -ql PACKAGE_NAME

The—q flag queries the package, and the—l flag lists the files. This command helps one identify how a package affects your system, track configuration or executable files, and, in general, identify problems arising from missing or misplaced files. While the file installation paths are easily viewable to users, they also help keep track of the installed software easily.

Terminal Command to List Files Installed by a Package Using RPM

6. rpm Command Examples

 1: Query All Installed Packages

To perform a complete audit of all software installed on your system, use

rpm -qa

The—q flag queries the RPM database, and the -a flag lists all packages. This will be of great help to system administrators who need to determine which applications are installed, debug issues, or check for compliance with organizational policies. It gives a clear list of the package names, thus helping when tracking system versions and software updates.

Terminal Command to List All Installed Packages Using RPM

 2: Install a New Package

To install a software package while tracking its progress, use the command.

rpm -ivh example-1.0.0.rpm

The—i flag starts the installation process, the—v flag provides more detailed information, and the—h displays progress hash marks. This approach makes it easier to track every step of the installation process and detect problems when they appear. It is used where the installation is big or crucial since visibility and errors must be identified for a seamless process.

Terminal Command to Install RPM Package with Progress and Verbose Output

 3: How to Verify if a Package is Installed with RPM

To confirm that essential software remains intact and unaltered, use

rpm -V ModemManager

The -V flag verifies the integrity of the specified package by comparing its current state with the original installation files. Any discrepancies, such as missing files, altered permissions, or corrupted data, are flagged. This command is essential for maintaining system security and stability for sensitive software like ModemManager, where unauthorized modifications could lead to malfunctions or vulnerabilities.

Terminal Command to Verify Package Integrity with RPM

 4: Remove Unwanted Software

To uninstall software that is no longer needed, use

rpm -e nginx

The—e flag, short for “erase,” confirms that the specified package and associated files are removed from your system. Eliminating unused applications helps free up disk space, resolve software conflicts, or declutter your environment. Removing outdated or unnecessary packages also reduces potential security risks and improves system performance by maintaining a cleaner and more efficient setup.

Terminal Command to Uninstall Package Using RPM

7. Tips for Mastering the rpm Command

  1. Combined with Other Tools: RPM functionality can be increased alongside tools like yum or dnf. These tools automatically handle dependencies, installations, and updates, and RPM may flag them as missing. This combination simplifies package management for complex systems with many interdependencies.

Check Logs: Redirect outputs to logs for better tracking.

rpm -qa > installed-packages.log
Terminal Command to Redirect RPM Output to a Log File
  1. Use Repositories: Always download packages from trusted sources to minimize risks.
  2. Stay Updated: Keep the rpm utility up-to-date to benefit from bug fixes and security enhancements.

8. Conclusion

Software management using the rpm command is more controlled in RPM-based Linux distribution systems such as Red Hat Enterprise Linux, Fedora, and Cent OS. Whether querying details of packages or defining integrity or dependency levels, rpm offers sound functionality for system management.


When used together with yum or dnf, it provides automatic solutions for dependency solving and even tricky package management. This process increases security compared with simply using logs to record outputs and downloads from reliable sources. Periodic updates keep the rpm utility reliable, making it an essential tool for Linux administrators and users as they help keep the systems more stable and organized.

About the writer

Vinayak Baranwal Article Author

Vinayak Baranwal wrote this article. Use the provided link to connect with Vinayak on LinkedIn for more insightful content or collaboration opportunities.

Leave a Reply

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

Lifetime Solutions:

VPS SSD

Lifetime Hosting

Lifetime Dedicated Servers