Linux rpm command

The rpm command in Linux is used to manage RPM packages, which are software packages in the RPM (Red Hat Package Manager) format. RPM packages are commonly used in Linux distributions based on Red Hat, such as CentOS and Fedora. The rpm command allows you to install, query, verify, upgrade, and remove RPM packages.

Here’s an overview of how to use the rpm command:

  1. Installing an RPM Package:
    To install an RPM package, use the -i (install) option followed by the name of the RPM file. For example:
   rpm -i package.rpm

This command installs the RPM package named package.rpm.

  1. Querying RPM Packages:
    To query information about installed RPM packages, use the -q (query) option followed by specific query options. For example:
  • Query package information: rpm -q package
  • List all installed packages: rpm -qa
  • Display detailed information about a package: rpm -qi package
  1. Verifying RPM Packages:
    To verify the integrity of installed RPM packages, use the -V (verify) option followed by specific verification options. For example:
  • Verify package file size and permissions: rpm -V package
  • Verify all installed packages: rpm -Va
  1. Upgrading an RPM Package:
    To upgrade an installed RPM package, use the -U (upgrade) option followed by the name of the RPM file. For example:
   rpm -U package.rpm

This command upgrades the RPM package named package.rpm if a previous version is installed.

  1. Removing an RPM Package:
    To remove an installed RPM package, use the -e (erase) option followed by the name of the package. For example:
   rpm -e package

This command removes the RPM package named package from the system.

  1. Examples:
  • Installing an RPM package: rpm -i package.rpm This command installs the RPM package named package.rpm.
  • Querying package information: rpm -q package This command queries information about the RPM package named package.
  • Verifying package integrity: rpm -V package This command verifies the integrity of the RPM package named package.
  • Upgrading an RPM package: rpm -U package.rpm This command upgrades the RPM package named package.rpm if a previous version is installed.
  • Removing an RPM package:
    rpm -e package
    This command removes the RPM package named package from the system.

The rpm command provides a powerful set of tools for managing RPM packages in Linux. It allows you to install, query, verify, upgrade, and remove RPM packages, making it essential for package management in RPM-based distributions.

For more information about the rpm command and its options, you can refer to the manual page by typing man rpm in your terminal.