Skip to main content

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
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'

dpkg list installed packages on Ubuntu or Debian Linux
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'

Filter out packages using the grep command on Linux
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

OR
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:
Linux uninstall package using apt command
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
RHEL CentOS Oracle Linux uninstall software using yum
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

ArchLinux
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
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

zypper command

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
apk command in action

Conclusion

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

Comments

Popular posts from this blog

4 Ways to Communicate Across Browser Tabs in Realtime

1. Local Storage Events You might have already used LocalStorage, which is accessible across Tabs within the same application origin. But do you know that it also supports events? You can use this feature to communicate across Browser Tabs, where other Tabs will receive the event once the storage is updated. For example, let’s say in one Tab, we execute the following JavaScript code. window.localStorage.setItem("loggedIn", "true"); The other Tabs which listen to the event will receive it, as shown below. window.addEventListener('storage', (event) => { if (event.storageArea != localStorage) return; if (event.key === 'loggedIn') { // Do something with event.newValue } }); 2. Broadcast Channel API The Broadcast Channel API allows communication between Tabs, Windows, Frames, Iframes, and  Web Workers . One Tab can create and post to a channel as follows. const channel = new BroadcastChannel('app-data'); channel.postMessage(data); And oth...

Certbot SSL configuration in ubuntu

  Introduction Let’s Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free  TLS/SSL certificates , thereby enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, Certbot, that attempts to automate most (if not all) of the required steps. Currently, the entire process of obtaining and installing a certificate is fully automated on both Apache and Nginx. In this tutorial, you will use Certbot to obtain a free SSL certificate for Apache on Ubuntu 18.04 and set up your certificate to renew automatically. This tutorial will use a separate Apache virtual host file instead of the default configuration file.  We recommend  creating new Apache virtual host files for each domain because it helps to avoid common mistakes and maintains the default files as a fallback configuration. Prerequisites To follow this tutorial, you will need: One Ubuntu 18.04 server set up by following this  initial ...

Working with Node.js streams

  Introduction Streams are one of the major features that most Node.js applications rely on, especially when handling HTTP requests, reading/writing files, and making socket communications. Streams are very predictable since we can always expect data, error, and end events when using streams. This article will teach Node developers how to use streams to efficiently handle large amounts of data. This is a typical real-world challenge faced by Node developers when they have to deal with a large data source, and it may not be feasible to process this data all at once. This article will cover the following topics: Types of streams When to adopt Node.js streams Batching Composing streams in Node.js Transforming data with transform streams Piping streams Error handling Node.js streams Types of streams The following are four main types of streams in Node.js: Readable streams: The readable stream is responsible for reading data from a source file Writable streams: The writable stream is re...