rpm: Command Examples in Linux

The “rpm” command is the default package manager used in most Linux distributions that use the Red Hat Package Manager (RPM) format. The RPM format is used to package software applications and their dependencies, making it easier to install, manage, and update software packages on a Linux system.

The “rpm” command is used to manage these packages, including installing, removing, querying, and verifying their contents. It can also be used to update packages and manage dependencies.

rpm Command Examples

1. Show version of httpd package:

# rpm --query httpd

2. List versions of all matching packages:

# rpm --query --all 'mariadb*'

3. Forcibly install a package regardless of currently installed versions:

# rpm --upgrade package_name.rpm --force

4. Identify owner of a file and show version of the package:

# rpm --query --file /etc/postfix/main.cf

5. List package-owned files:

# rpm --query --list kernel

6. Show scriptlets from an RPM file:

# rpm --query --package --scripts package_name.rpm

7. Show changed, missing and/or incorrectly installed files of matching packages:

# rpm --verify --all 'php-*'

8. Display the changelog of a specific package:

# rpm --query --changelog package_name

The “rpm” command can also be used to create RPM packages from source code, which can be distributed and installed on other Linux systems. This is done using the “rpmbuild” subcommand, which allows you to create source RPMs and binary RPMs for your software.

Overall, the “rpm” command is a powerful and flexible tool for managing software packages on Linux systems. It provides a robust system for managing dependencies and ensuring that software applications are installed correctly and consistently across different systems.

Related Post