Red Hat: dnf/yum & rpm
Red Hat / Fedora - dnf & rpm
The Red Hat family (RHEL, Fedora, Rocky, CentOS) mirrors the same two-tier design you just saw on Debian - a low-level tool (rpm) for single package files, and a high-level tool (dnf, the modern successor to yum) that talks to repositories and resolves dependencies.
| Task | Command |
|---|---|
| Install | dnf install <pkg> |
| Remove | dnf remove <pkg> |
| Upgrade all | dnf upgrade |
| Search | dnf search <term> |
| Info | dnf info <pkg> |
| Package groups | dnf group list / dnf group install |
| Install a local .rpm | rpm -ivh file.rpm |
| Query installed | rpm -qa |
| Which package owns a file | rpm -qf /path |
| List a package's files | rpm -ql <pkg> |
Unlike apt, dnf doesn't need a separate "update the index" step before every install - it checks repository metadata automatically and caches it. Repos themselves are defined in .repo files under /etc/yum.repos.d/.
$ rpm -qf /usr/bin/ssh
openssh-clients-8.7p1-34.el9.x86_64
This is the same "which package owns this file?" question from the Debian section, just with the Red Hat equivalent flag (-qf = query, file).
Tip:rpm's flags read almost like English once you memorize them as words rather than letters:-iinstall,-vverbose (show progress),-hhash marks (a progress bar made of#),-Uupgrade-or-install in one step,-eerase (remove),-qquery.rpm -ivh file.rpmis "install, verbosely, with a hash progress bar" - a combination you'll type from memory after a week on Red Hat systems.