RPM Cheatsheet
#
rpm
is a command-line utility for managing RPM packages on RPM-based Linux distributions.
Basic Commands
#
Command/Option | Example | Description |
---|
rpm -i <package.rpm> | rpm -i example-package-1.0-1.x86_64.rpm | Install a package |
rpm -e <package> | rpm -e example-package | Uninstall a package |
rpm -U <package.rpm> | rpm -U example-package-1.1-1.x86_64.rpm | Upgrade a package |
rpm -q <package> | rpm -q example-package | Query if a package is installed |
rpm -ql <package> | rpm -ql example-package | List files installed by a package |
rpm -qi <package> | rpm -qi example-package | Display information about an installed package |
Command/Option | Example | Description |
---|
rpm -qa | rpm -qa | List all installed packages |
rpm -qf <file> | rpm -qf /usr/bin/example | Find which package a file belongs to |
rpm -q --changelog <package> | rpm -q --changelog example-package | Show the changelog of a package |
rpm -qi <package> | rpm -qi example-package | Show detailed information about a package |
Package Creation and Verification
#
Command/Option | Example | Description |
---|
rpm --checksig <package.rpm> | rpm --checksig example-package-1.0-1.x86_64.rpm | Verify the signature of a package |
rpm -K <package.rpm> | rpm -K example-package-1.0-1.x86_64.rpm | Check the package integrity and signature |
rpm -ba <specfile> | rpm -ba example.spec | Build a binary and source RPM from a spec file |
Database Operations
#
Command/Option | Example | Description |
---|
rpm --rebuilddb | rpm --rebuilddb | Rebuild the RPM database |
rpm --initdb | rpm --initdb | Initialize the RPM database |
Query Options
#
Command/Option | Example | Description |
---|
rpm -q --provides <package> | rpm -q --provides example-package | List capabilities provided by a package |
rpm -q --requires <package> | rpm -q --requires example-package | List dependencies required by a package |
Miscellaneous
#
Command/Option | Example | Description |
---|
rpm -h | rpm -h | Print hash marks as the package is installed |
rpm --help | rpm --help | Display help information about rpm commands |
This cheatsheet provides essential rpm
commands and options for managing RPM packages on RPM-based systems.