Installing Debian packages is one of the easiest parts of using Linux but when we talk about the uninstallation process, things are quite rough on this side as you get multiple options to remove packages such as dpkg to uninstall packages, purging, and GUI facilities too.
So we are going to show you an in-depth tutorial on how you can use each tool available to use for uninstalling Debian packages with multiple choices and options. So lets’ start our process by getting a list of installed packages.
Table of Contents
List Installed Packages Using Dpkg
We are going to use the dpkg –list command to show all the installed packages. This is an essential step because often we don’t know the full name of the package that we want to remove and using the wrong name, we get an error saying “Unable to locate package“
But if you know the exact name of the package, you can skip this step.
Open your Terminal and use the following command to list all the installed packages:
Scroll down and you will find your desired package which you want to remove. In our case it’s TeamViewer. We will be using the same package for all the removal demonstrations.
Uninstall Packages Using apt-get
You can remove packages using apt-get but you will have to use some parameters which we are going to discuss further. As we are required to remove packages, we will be using two parameters “remove” and “–purge”.
The first parameter “remove” will remove packages but keep all the configuration files but we also want to remove configuration files and this is the reason why we have used the second parameter “–purge” which will remove configuration files too.
Use the following command to remove required packages using apt-get:
sudo apt-get –purge remove teamviewer
As you can see, it asks our permission to remove TeamViewer but if you want to automate this process that won’t ask for your password, you can use -y at the end of the command.
sudo apt-get –purge remove teamviewer -y
If you want to uninstall packages without using “remove” parameters, you can easily do it by just using the ” –purge” parameter. This will remove binaries and configuration files related to our desired package, in our case it’s TeamViewer.
You can follow the given command to use only the “–remove” parameter.
sudo apt-get purge teamviewer
There is another where we only use remove which will only delete packages keeping configuration files and data. If you are someone who wants to remove only package keeping files safe, you can follow the given command:
sudo apt-get remove temviewer
Uninstall Packages Using Dpkg
Linux has always been about choice and you get multiple ways to perform almost any task you desire. As we have already discussed one way to uninstall packages using apt-get and you also have another way to uninstall packages using dpkg.
We can easily remove packages using the following command where we have just interchanged apt-get with dpkg:
sudo dpkg –remove teamviewer
You can also use -r instead of –remove as they are both the same. It will look similar to the following command:
sudo dpkg -r teamviewer
Uninstall Broken Packages
As Linux user, we often face a situation where our package is not installed properly which cause malfunctioning and we often fail to locate that package as it is not installed properly.
But you can easily overcome all the issues which you might be facing due to broken packages by given commands:
sudo apt-get clean && sudo apt-get autoremove
This command will remove the old cache of programs that are older than the current version installed and also remove unnecessary files including dependencies that are no longer required.
sudo apt-get -f install
This command will fix all the broken dependencies and will correct package corruption problems.
sudo dpkg –configure -a
This command will solve the remaining problems.
Uninstall Packages Using Apt
According to many users apt and apt-get are the same but they are not. They may work in similar ways with the similar syntax but still, they are different from their core. For example, we can list all the installed software such as we have previously done with dpkg.
Use the following command to list installed packages using apt:
apt list –installed
To remove the package without including its configuration files and dependencies, use the following command:
sudo apt remove teamviewer
If you want to remove binaries, configuration files, data, and dependencies, use the following command:
sudo apt purge –auto-remove teamviewer
It would ask for your permission and you can remove this part similarly we have done previously by adding -y at the end of the command.
sudo apt purge –auto-remove teamviewer -y
Uninstall Packages Using GUI
Yes, you can remove packages using GUI which won’t involve any complex tasks. We are going to show you two ways by which you can remove installed packages from Debian-based distributions. So let’s start our process with the easiest one.
Uninstall Packages Using Software Center
This method can be only applicable if you have installed any software and does not apply to all Debian packages such as libraries and dependencies.
Click on Activities located in lop left corner and type software. Hit Enter on the first result.
Click on Installed and scroll down till you find your desired package that you want to remove. Once you find that package, click on remove
You will be asked again whether you want to remove it or not. Click on remove and it will ask for your password. Enter your password and it will remove that package.
Uninstall Packages Using Synaptic
This is considered the best tool to manage your applications using GUI. Unlike the software center, where you can not remove dependencies, you can easily remove them using Synaptic. In Debian it is pre-installed but if you have removed it, you can install it by the given command:
sudo apt install synaptic
Once you install Synaptic, click on Activities and type Synaptic. Hit Enter on the first result and it will open Synaptic.
Click on the Search button and type the desired package that you want to remove. Hit Enter and it will show similar results.
We have to locate the installed package which will have green color filled in the checkbox. Right-click on the package and select the option named “Mark for complete removal“.
Click on the apply button and it will bring a list of all packages. Click on Apply again to remove.
It will show you the process of package removal.
Frequently asked questions related to Debian package removal
How do I uninstall a program on Debian?
You can use this command: sudo apt remove <package name> to remove the required package from Debian which will disclude the configuration file and data. If you want to remove a package with its dependencies, use this command: sudo apt purge –auto-remove <package name>
How do I purge a Debian package?
There is a specific way to purge a Debian package that will remove configuration files and binaries related to the package. Use this command to purge a package from Debian: sudo apt purge <package name>
How do I completely remove a package in Linux?
If you want to remove the package completely which includes dependencies, data, configuration files, and binaries. Use this command to remove the package completely from Linux: sudo apt purge –auto-remove <package name>
- How to Uninstall Python in Ubuntu
- How to Uninstall TeamViewer on Ubuntu
- How to Uninstall NGINX Ubuntu
Which method do you prefer the most for package removal?
There are multiple ways by which you can uninstall packages from Debian such as package uninstallation using dpkg, apt-get, apt, and GUI. So we included everything by which you can benefit the most from the package removal process.