Linux uninstall package / software using the CLI

How do I uninstall package or software using the command line in Linux operating systems? How can I uninstall software on a Debian or Ubuntu Linux? Can you tell me command to uninstall package on a CentOS/RHEL/Oracle/Fedora Linux?

Strictly speaking, Linux is the kernel. Linux distribution is made of Linux kernel, installation scripts, shell, compilers, desktop, and other components. Hence, Linux command to uninstall package or software depends upon Linux distribution name and type. This page explains how to uninstall package or software on various Linux distros using the command line.

Linux uninstall package / software

  1. First, you need to find a list of all installed packages on Linux.
  2. To uninstall an application, you need to use Linux distro-specific command. For example, use the apt command on Debian or Ubuntu Linux. RHEL/CentOS/Fedora Linux users need to run either the dnf or yum command and so on.
  3. Finally, we can use various commands for verification of the uninstallation of a program on Linux.

Let us see all commands in action to uninstall a program on Linux.

Ubuntu/Debian Linux uninstall software

The syntax is as follows to list all installed packages on Debian or Ubuntu Linux using the apt command:
apt list --installed

How to find out exact package names in Debian/Ubuntu/Mint Linux

Another option for finding out package names is to use the dpkg command:
dpkg --list
dpkg --list | grep '^ii'

Use the ‘dpkg --list‘ command to get a list of all installed packages on an Ubuntu or Debian/Mint Linux

It will be a big list, and we need to scroll through package names on a computer screen until you find the one you want to uninstall. Of course, we can use the grep command to filter out the list as follows:
dpkg --list | grep -i 'package'
apt list --installed \*package\*
apt list --installed \*ping\*
dpkg --list | grep -i 'firefox'
dpkg --list | grep -i 'ping'

grep command in action to filter out package names quickly that you want to uninstall

Let us uninstall the program named 2ping using the apt-get command or apt command. For example:
sudo apt remove 2ping
sudo apt remove --purge 2ping

sudo apt-get remove 2ping
sudo apt-get --purge remove 2ping

First, you need to enter your password when prompted and press the [Enter] key. The --purge is optional. We use it when we need to uninstall the package and all of its configuration files. When prompted, “Do you want to continue?”, type a y and press the [Enter] key:

Do not pass the --purge option if you don’t want to delete the config file for the package. For example, to remove the nginx package and leave all config files as it is on disk, run:
sudo apt remove nginx
#### OR #####
sudo apt-get remove nginx

Finally verify that nginx has been removed or uninstalled from the system, run:
dpkg --list | grep nginx
apt list --installed | grep nginx

Now you know how to uninstall package on a Debian or Ubuntu or Mint Linux. Let us see other distros.

RHEL/CentOS/Oracle Linux

We need to use the yum command for CentOS/RHEL v6.x/7.x. First get a list, run:
sudo yum list installed
sudo yum list installed | grep package
sudo yum list installed | grep zip

yum command in action

To uninstall the package named zip, run:
sudo yum remove zip
Use the dnf command on a CentOS/RHEL/Oracle Linux 8 as follows to uninstall software:
sudo dnf list installed
sudo dnf list installed | grep zip
sudo dnf remove zip

Fedora Linux

Again, we need to the dnf command as follows:
## List all installed packages ##
sudo dnf list installed
## Filter out the package named httpd ##
sudo dnf list installed | grep httpd
## Delete the httpd ##
sudo dnf remove httpd

Arch Linux

We use the pacman command on Arch Linux to uninstall software. Pass the Q to list all installed packages on Arch Linux:
sudo pacman Q
sudo pacman Q | more
sudo pacman Q | grep sl

To delete/remove the sl package in Arch, run:
sudo pacman -R sl

pacman command in action to list and uninstall package on an Arch Linux

OpenSUSE or SUSE Linux removing package command

We are going to use the zypper command. To list all installed packages in SUSE/OpenSUSE, run:
sudo zypper packages --installed-only
sudo zypper packages --installed-only | grep -i package
sudo zypper packages --installed-only | grep -i zip

I am going to remove the zip package, enter:
sudo zypper remove package
sudo zypper remove zip

Alpine Linux

Use the apk command to list installed packages only:
sudo apk list
sudo apk list -I
sudo apk list -I 'package'
sudo apk list -I 'zip'

To uninstall the zip Linux uninstall software pass the del as follows:
sudo apk del pkg
sudo apk del zip

apk command in action


You learned how to uninstall package on popular Linux distros. I would strongly recommend reading the man pages:
man yum
man dnf
man apt
man zypper
man pacman

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum