zypper, dnf and apt compared: a package cheat sheet

Install, upgrade, search and clean up packages on openSUSE, Fedora and Debian/Ubuntu without guessing.

Part 2 of 12 in Linux basics for self-hosters. Last updated

In short: Install with sudo zypper in, sudo dnf install or sudo apt install; search with zypper se, dnf search or apt search. To update everything: sudo zypper dup on Tumbleweed, sudo zypper up (or zypper patch) on Leap, sudo dnf upgrade on Fedora, and sudo apt update followed by sudo apt upgrade on Debian and Ubuntu. For files, rpm -qf and dpkg -S tell you which package installed them.

The cheat sheet

Every row does the same job in all three columns. Replace pkg with a package name. Commands that change the system need sudo; searching and listing do not. Fedora 41 and newer ship dnf5, which accepts the commands below; the output looks different from the older dnf.

Package management on openSUSE (zypper), Fedora (dnf) and Debian/Ubuntu (apt)
TaskopenSUSE: zypperFedora: dnfDebian and Ubuntu: apt
Refresh repository metadatasudo zypper refsudo dnf makecachesudo apt update
Update everythingTumbleweed: sudo zypper dup
Leap: sudo zypper up
sudo dnf upgradesudo apt update, then sudo apt upgrade
List available updateszypper lu (Leap patches: zypper lp)dnf check-upgradeapt list --upgradable
Install a packagesudo zypper in pkgsudo dnf install pkgsudo apt install pkg
Remove a packagesudo zypper rm pkgsudo dnf remove pkgsudo apt remove pkg
Remove unneeded dependenciessudo zypper rm -u pkg while removing; list them with zypper pa --unneededsudo dnf autoremovesudo apt autoremove
Search by name or summaryzypper se termdnf search termapt search term
Show package detailszypper if pkgdnf info pkgapt show pkg
List installed packageszypper se -idnf list --installedapt list --installed
Which package owns this installed file?rpm -qf /pathrpm -qf /pathdpkg -S /path
Which package would provide this file?zypper se --provides /usr/bin/htopdnf provides /usr/bin/htopapt-file search /usr/bin/htop (install apt-file first)
List the files of an installed packagerpm -ql pkgrpm -ql pkgdpkg -L pkg
Keep a package at its versionsudo zypper al pkgsudo dnf versionlock add pkgsudo apt-mark hold pkg
List repositorieszypper lr -udnf repolistapt-cache policy
Clear the download cachesudo zypper clean -asudo dnf clean allsudo apt clean
What changed recently?/var/log/zypp/historydnf history list/var/log/apt/history.log

On older Fedora releases with dnf4, versionlock needs the versionlock plugin package. References: zypper usage, dnf5 documentation and apt(8).

zypper, dnf and apt work the same way; a dry run shows step 4 and stops.

Two rows of the table, run for real. Owner lookups work without sudo. On Debian the dpkg database still records the old /bin paths, so ask for /bin/bash, not /usr/bin/bash:

$ rpm -qf /usr/bin/ssh /usr/bin/zypper
openssh-clients-10.5p1-1.1.x86_64
zypper-1.14.98-1.3.x86_64

$ dpkg -S /usr/bin/bash; dpkg -S /bin/bash
dpkg-query: no path found matching pattern /usr/bin/bash
bash: /bin/bash

Real output on openSUSE Tumbleweed and Debian 12, 2026-09-28; user and host names and addresses redacted.

$ zypper --no-refresh info podman
Information for package podman:
-------------------------------
Repository     : Main Repository (OSS)
Name           : podman
Version        : 6.0.2-1.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 55.1 MiB
Installed      : Yes
Status         : up-to-date
Source package : podman-6.0.2-1.1.src
Upstream URL   : https://github.com/containers/podman
Summary        : Daemon-less container engine for managing containers, pods and images

Real output on openSUSE Tumbleweed, 2026-09-28; user and host names and addresses redacted.

Upgrading: dup, up and patch

openSUSE has three update commands, and which one is right depends on the distribution:

  • zypper dup (dist-upgrade) makes the system match the repositories: it upgrades, downgrades, removes and replaces packages as needed. This is the update command on Tumbleweed, because every snapshot can rename or drop packages.
  • zypper up (update) installs newer versions of installed packages and nothing else. Right for Leap, wrong for Tumbleweed.
  • zypper patch installs only official patches, the security and bug fixes the Leap maintainers released. It is the most conservative choice for a Leap server.

After an update, zypper ps -s lists running programs that still use deleted files, which tells you which services to restart, and zypper needs-rebooting tells you whether the kernel or another core library changed. Moving Leap to its next minor or major release is a separate, planned step; follow the release notes of the new version.

Try before you change anything

All three can show what they would do without doing it. Use this before a big update or when a removal suggests taking half the system with it:

sudo zypper dup --dry-run      # openSUSE: short form -D
sudo dnf upgrade --assumeno    # Fedora: resolves, prints the plan, answers no
apt -s upgrade                 # Debian/Ubuntu: -s simulates, no sudo needed

The simulation really needs no sudo; as a normal user on Debian 12:

$ apt -s upgrade 2>/dev/null | tail -4
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Real output on Debian 12, 2026-09-28; user and host names and addresses redacted.

zypper is stricter: zypper dup --dry-run as a normal user on Tumbleweed answered Root privileges are required to run this command., so run its dry run with sudo.

Read the list of packages to be removed first. That is where surprises live. If a flag in a long command is unclear, the shell command explainer breaks it down.

Flatpak and immutable systems

Desktop apps such as a browser or an office suite are often easier as Flatpaks: the same command works on every distribution, flatpak install flathub org.mozilla.firefox, and updates come with flatpak update. For server software, containers play the same role; the quadlet examples show how to run them with podman and systemd.

Immutable variants (openSUSE Aeon and MicroOS, Fedora Silverblue and CoreOS) do not change the running system at all. On the openSUSE ones, sudo transactional-update dup prepares a new snapshot and the update takes effect at the next reboot. Fedora's atomic variants use rpm-ostree instead.

Common mistakes

Using apt upgrade without apt update first

apt does not refresh its package lists on its own. Without sudo apt update, apt upgrade compares against lists that may be weeks old and reports "0 upgraded" while fixes are waiting. zypper and dnf refresh expired metadata themselves.

Running a copied table from another distribution family

Cheat sheets online sometimes shift columns, so the Fedora cell shows a pacman command. If a command answers with "command not found" or an unknown option, check which distribution it was written for before adding sudo and trying harder.

Confirming a removal without reading it

zypper rm, dnf remove and apt remove also remove packages that depend on the one you name. A single library can take a desktop with it. Read the list, answer no if it is longer than expected, and run the removal with a dry run first (zypper rm --dry-run pkg, apt -s remove pkg). Next in the series: the desktops those package managers install.

Frequently asked questions

What is the zypper equivalent of apt update?

sudo zypper refresh (short: zypper ref) downloads fresh repository metadata, like apt update. You rarely need it on its own: zypper refreshes expired metadata automatically before in, up and dup.

Should I use zypper up or zypper dup on Tumbleweed?

Always sudo zypper dup on Tumbleweed. zypper up only installs newer versions of packages you already have and cannot handle removals or renames between snapshots. On Leap, use zypper up or zypper patch for day-to-day updates.

How do I find which package a command comes from?

For a file that is installed: rpm -qf /usr/bin/htop on openSUSE and Fedora, dpkg -S /usr/bin/htop on Debian and Ubuntu. For a command you do not have yet: zypper se --provides /usr/bin/htop, dnf provides /usr/bin/htop, or apt-file search /usr/bin/htop after installing apt-file.

What is the difference between apt upgrade and apt full-upgrade?

apt upgrade never removes a package, so it holds back updates that need a removal. apt full-upgrade may remove packages to complete the upgrade. Use upgrade for routine updates and read the list carefully before you confirm a full-upgrade.