← Packages & Services
Linux · Packages & Services

How to remove a package in Linux

Remove a package with dnf remove and apt remove/purge, checking what dependencies go with it first.


Uninstall a package. Run as root, and check the removal plan before answering yes.

Removing a package can also remove packages that depend on it. Read the list dnf/apt prints before confirming, since removing a shared library can break other software.

# RHEL / Oracle Linux
sudo dnf remove <pkg>

# Debian / Ubuntu (remove keeps config; purge removes it too)
sudo apt remove <pkg>
sudo apt purge <pkg>

# Clean up now-unused dependencies
sudo dnf autoremove       # RHEL/OL
sudo apt autoremove       # Debian/Ubuntu
Linuxdnfremove