rpm Command in Linux
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
Overview
In the Linux ecosystem, the rpm command serves as a robust utility for package management. Standing for Red Hat Package Manager, the rpm command in Linux offers the ability to install, uninstall, upgrade, query, and verify packages. It's a critical tool for system administrators, offering an efficient method for managing software on Linux distributions that use .rpm packages.
Syntax of rpm Command in Linux
The basic syntax of the rpm command in Linux is as follows:
Where:
- options: These are the flags or switches that you can use with the rpm command. They tell the command what function to perform, such as installing, upgrading, or querying a package.
- package_file | package_name: This is the specific .rpm package file or the installed package name you're dealing with. It could be a package you're looking to install, upgrade, verify, or remove.
Options in rpm Command in Linux
-
-i | --install: This option is used to install a new package.
For example -
This command will install the 'sample_package.rpm' package.
-
-q | --query: This option is used to query an installed package or a .rpm package file.
For example -
Output:
This command queries the installed 'sample_package' and returns its version if it exists.
-
-e | --erase: This option is used to remove an installed package.
For example -
This command will remove the installed 'sample_package'.
Scaler Placement Report and Statistics
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
Example Usages
-
Installing a package:
Explanation: This usage of the rpm command in Linux installs 'sample_package.rpm'.
-
Querying a package:
Output:
Explanation: This usage queries the installed 'sample_package' and returns its version.
Tips
-
You can use the -v option along with -i, -e, or -U to get more detailed output.
-
To install or uninstall packages, you need to have root permissions or use sudo.
Turn Learning into Career Growth
Advanced Use Cases of rpm Command in Linux
-
Upgrade a package:
Explanation: This command will upgrade the 'sample_package' to the version provided in the .rpm file, or install it if it doesn't exist.
-
Query all installed packages:
Output:
Explanation: This command lists all installed packages on the system.
-
Verify an installed package:
Explanation: This command verifies the integrity of the installed 'sample_package'. It compares the size, digest, permissions, type, owner, group, modification time, and capabilities of each file against the values from the database.
Conclusion
-
The rpm command in Linux provides a powerful tool for managing software packages.
-
The command includes options to install, uninstall, upgrade, query, and verify packages.
-
Being familiar with the rpm command is essential for system administrators managing Linux distributions that use .rpm packages.




