Packages and services

Command rpm

Work with rpm packages directly

Linux · Bash examples · commands run on the selected server

When to use rpm

Use rpm queries to inspect installed RPM packages and map paths to package ownership. Querying a package database is different from installing or resolving repository transactions through a higher-level package manager.

Syntax

rpm [PARAMETERS] [PACKAGE...]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-q
Query the status of an installed package.
-ql PACKAGE
Show files of an installed package.
-qf PATH
Find package by file.

Usage examples

Check whether Bash is installed

rpm -q bash

The installed package name and version are queried.

View package files

rpm -ql bash

Paths recorded as part of the package are listed.

Find the owner of a binary file

rpm -qf /usr/bin/bash

The package owning the selected executable path is looked up.

Notes and limitations

  • rpm - low-level base and package tool; It is more convenient to resolve dependencies during normal operation via dnf.
  • Do not use --nodeps and --force as a universal fix for your installation.

Common questions and troubleshooting

Why is a path not owned by any package?

It may be locally installed, generated at runtime or referenced through another path. Resolve symlinks and inspect the installation method.

Does rpm -q search available repositories?

It queries installed package data. Use the distribution's repository manager to search packages that are not installed.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man rpm.