YUM and DNF vs. Zypper vs. APT, RPM vs. dpkg command comparison and cheat sheet

Written by - 2 comments

Published on - last updated on May 21st 2024 - Listed in Linux Shell


The following table shows a comparison of the most important and most used commands for package/software management in SuSE and Debian/Ubuntu systems.

yum vs. zypper vs. apt command comparison

The yum command is available on Enterprise Linux (such as Red Hat Enterprise Linux, RockyLinux, Almalinux, Oracle Linux and others) systems. Since EL8, the dnf command replaces the yum command.

The zypper command is available on SuSE systems.

The apt and related commands are available on Debian and Debian-based systems including Ubuntu, Linux Mint, Knoppix, and a lot more.

 Purpose  yum (and dnf) command
 zypper command
 apt command
Search a package
yum search "pkgname"
dnf search "pkgname"
zypper se "pkgname"
apt-cache search "pkgname"
apt search "pkgname"
Install a package
yum install "pkgname"
dnf install "pkgname"
zypper in "pkgname"
apt-get install "pkgname"
apt install "pkgname"
Update package list from repositories
tbv
zypper refresh apt-get update
apt update
Update all packages
yum update
dnf update
zypper update apt-get upgrade
apt upgrade
Upgrade all packages to a new major version
yum update
dnf update
zypper dist-upgrade apt-get dist-upgrade
apt dist-upgrade
Update a single package
yum install "pkgname"
dnf install "pkgname"
zypper update "pkgname" apt-get install "pkgname"
apt install "pkgname"
Downgrade a single package
yum downgrade "pkgname-versiontag"
dnf downgrade "pkgname-versiontag"
tbv
apt-get install "pkgname=versiontag"
apt install "pkgname=versiontag"
Show packages with updates
yum check-update
dnf check-update
zypper list-updates apt-show-versions -u
apt list --upgradable
Re-Install a package
yum reinstall "pkgname"
dnf reinstall "pkgname"
tbv
apt-get install --reinstall "pkgname"
Uninstall/remove a package yum remove "pkgname"
dnf remove "pkgname"
zypper remove "pkgname" apt-get remove "pkgname"
apt remove "pkgname"
Remove unused packages yum autoremove
dnf autoremove
tbv
apt-get autoremove
apt autoremove
Show all packages found in repo(s) yum list
dnf list
zypper packages apt-cache pkgnames
Show all versions of a package in repo(s)
dnf list "pkgname" --showduplicates
tbv
apt-cache show "pkgname" | grep "^Version"
Show description of a package yum info "pkgname"
dnf info "pkgname"
zypper info "pkgname" apt-cache show "pkgname"
apt show "pkgname"
Show dependencies of a package yum deplist "pkgname"
dnf deplist "pkgname"
dnf repoquery --deplist "pkgname"
tbv
apt-cache depends "pkgname"
apt depends "pkgname"
Show contents (files) of a package
repoquery -l "pkgname"
dnf repoquery -l "pkgname"
tbv
apt content "pkgname"

rpm vs. dpkg command comparison

 Purpose
 rpm command
dpkg command
List installed packages rpm -qa dpkg -l
List content of installed package rpm -ql "pkgname"
dpkg -L "pkgname"
List content of package file rpm -qlp "pkgname".rpm
dpkg --contents "pkgname".deb
List dependencies of package file
rpm -qp --requires "pkgname".rpm
dpkg -I "pkgname".deb | grep Depends
Install package rpm -i "pkgname".rpm
dpkg -i "pkgname".deb
Show to which package a file belongs
rpm -qf /path/to/file
dpkg -S /path/to/file
Simulate installation of package rpm -i --test "pkgname".rpm
dpkg -i --simulate "pkgname"
Update a package rpm -U "pkgname".rpm
N/A (use dpkg -i)
Uninstall/remove a package rpm -e "pkgname"
dpkg -r "pkgname"

If you know additional zypper/apt/rpm/dpkg commands which are worth to be compared and mentioned here, please drop a comment.

Changelog

Update June 14th, 2013: Added apt-get dist-upgrade to the table. This command allows to upgrade to a newer major software version (e.g. MySQL 5.0 -> 5.1). However it should be mentioned, that although this command exists in Debian, it is unlikely that it's going be used (except for a distribution upgrade, e.g. lenny -> squeeze). The reason for this is the "stable software version" mind of Debian. Ubuntu handles this approach differently and frequently adds newer major versions to their repositories.

Update July 10th, 2015: Added "list content" rpm and dpkg commands.

Update September 16th, 2015: Added "Simulate installation of package" rpm and dpkg commands.

Update March 13th, 2019: Added "apt" short commands.

Update May 31st, 2019: Added "Show to which package a file belongs".

Update September 24th, 2020: Added "Remove unused packages"

Update December 19th, 2023: Added yum and dnf commands

Update January 17th, 2024: Added "Show contents of a package"

Update March 5th, 2024: Added "Show all versions of a package in repo(s)"

Update April 24th, 2024: Added "List dependencies of package file"


Add a comment

Show form to leave a comment

Comments (newest first)

anon from wrote on Jan 11th, 2014:

The zypper equivalent for a distribution upgrade (apt-get dist-upgrade) is "zypper dup". See https://en.opensuse.org/SDB:System_upgrade

The Arch wiki has a similar comparison of more tools:
https://wiki.archlinux.org/index.php/Pacman_rosetta


Alexander from Zürich wrote on Jun 12th, 2013:

Might be worth mentioning, that for Debian the "Update all packages" would rather be:

apt-get dist-upgrade

Because of the "all packages" there. Don't know how that compares to zypper.


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder