1

What is the equivalent of the Redhat command rpm -e in Ubuntu? I know it's probably dpkg something because the equivalent of rpm -qa is dpkg -l, but I can't tell what the equivalent command of rpm -e is in Ubuntu. However, I think it's dpkg -r aka --remove <package-name> or --remove-architecture, but I'm not sure.

This is different from the question about how to remove an application in Ubuntu because I want know the most exact equivalent in terms of actions performed of the rpm -e command and not just generally how to remove an application, even if apt or apt-get remove packagename is the recommended or preferred way and not dpkg -r packagename or dpkg --remove packagename.

Zanna
  • 72,312

1 Answers1

2
sudo apt remove PACKAGENAME     # for everyday use: fancy output
sudo apt-get remove PACKAGENAME # for scripts: stable output

is Ubuntu's equivalent of rpm -e, see the Table of Equivalent Commands for package management on Ubuntu and Red Hat systems.

While you're right that there's a also an equivalent dkpg command to remove a single package – namely dpgk -r PACKAGENAME – it's nevertheless advisable to use apt, citing Wikipedia:

While dpkg performs actions on individual packages, apt tools manage relations (especially dependencies) between them, as well as sourcing and management of higher-level versioning decisions (release tracking and version pinning).

A major feature in APT is the way it calls dpkg — it does topological sorting of the list of packages to be installed or removed and calls dpkg in the best possible sequence. In some cases, it utilizes the --force options in dpkg. However, it only does this when it is unable to calculate how to avoid the reason dpkg requires the action to be forced.

apt is like a front-end to dpkg, but it keeps track of dependencies and won't silently let you remove a package another package still depends on.

dessert
  • 40,956