To query your installed RPM packages or investigate standalone .rpm files on your disk, use the rpm query (-q) mode.
Common rpm Query Commands
| Command | Description | Typical Use Case |
|---|---|---|
rpm -qa |
List all installed packages | Finding all installed versions of your app: `rpm -qa \ |
{% raw %}rpm -q <name>
|
Check if a specific package is installed | Verifying if cpls-9.1.91n_b6 is present |
rpm -qi <name> |
Show package metadata (info) | Checking version, release, and install date |
rpm -ql <name> |
List all files belonging to an installed package | Seeing where the files for your app were actually deployed |
rpm -qf <path> |
Find which package owns a specific file | Determining which version of your app owns /opt/CPLS/live
|
rpm -qc <name> |
List configuration files for a package | Locating config files (if your RPM labels them as such) |
rpm -qd <name> |
List documentation files for a package | Finding man pages or readme files |
Querying Uninstalled .rpm Files
When you have a .rpm file that hasn't been installed yet, you must use the -p (package) flag. This tells RPM to inspect the file directly rather than the local database.
| Command | Description |
|---|---|
rpm -qp <file.rpm> |
Get the name/version of an uninstalled RPM file |
rpm -qpi <file.rpm> |
View metadata of an uninstalled RPM file |
rpm -qpl <file.rpm> |
List the files that will be installed by this file |
rpm -qpc <file.rpm> |
List the config files inside an uninstalled package |
Pro Tip: If you ever need to see exactly what an RPM will do before you run your Ansible playbook, use rpm -qpl package.rpm to verify the installation paths for every single file in the archive.
Top comments (0)