Hi there, In this tutorial, we are going to learn how to uninstall packages using
sudo apt uninstall in ubuntu. Before we uninstall a program using
sudo apt uninstall command, we should have some information about the apt package manager. Like, how to list packages and etc.
Table of Contents
Uninstalling packages is one of the essential tasks of package management in Linux-based operating systems like Ubuntu and Debian. You can easily remove or uninstall the packages you don’t need anymore. No matter if you are a beginner or an experienced Ubuntu user this tutorial will provide you with the proper information that you need to uninstall software packages from Ubuntu using the apt package manager.
What is APT Package Manager?
APT (Advanced Package Tool) is a package management utility for Debian or Ubuntu-based Linux operating systems. Using the APT package manager we can Install, remove or manage application packages in our system.
APT is the most popular open-source package management tool and has thousands of packages that can be freely installed and used.
So, it’s clear now that we can use the APT package management tool to install and remove software packages from the Ubuntu or Debian-based Linux distributions.
Before we get to our main topic, We think you should know how to list installed packages in Ubuntu.
So, here is the command for listing installed packages:
apt list --installed
How to Use
sudo apt uninstall Command
First of all, we would like to add that
sudo apt uninstall command works the same as
sudo apt remove command. You can uninstall software applications from your Ubuntu system using any of these two commands. It is better to use “remove” instead of “uninstall” for avoiding errors.
But if you are uninstalling a package using
sudo apt remove command then we would like to tell you the configuration file of the particular package will not be removed. You can remove the configuration files also using
sudo apt-get purge [Package_Name] command.
Follow the steps to use
sudo apt uninstall command:
Step 1: Open your Linux terminal.
Step 2: Now you need to enter the
sudo apt uninstall command followed by the package name you want to uninstall.
Suppose, you want to uninstall the TeamViewer package from your machine then you will have to run the following command:
sudo apt uninstall teamviewer
Once you run this command then you will be asked to enter the password as you need to have superuser privileges or sudo permission in order to remove a program from your system.
Once you enter the password then the process of uninstallation will begin to start.
Wait.. Some people might get the following error:
E: Invalid operation uninstall
Are you getting the same error while uninstalling a program from Ubuntu System?
You might get this error if the “uninstall” subcommand is not available for the “apt” version you are using.
In such a case, you can replace the “uninstall” subcommand with the “remove” subcommand of the apt package manager. Let’s have a look at the following example:
sudo apt remove teamviewer
This is how you can remove or uninstall software packages from your Ubuntu Linux.
Uninstalling Multiple Packages
We just learned how to remove a single package, but it is also possible to uninstall or remove multiple packages at once from the Ubuntu system.
Let’s have a look at the syntax for removing multiple packages at once:
sudo apt uninstall [PackageName] [PackageName] [PackageName]
Here, replace [PackageName] with the actual package name.
In the syntax, you can see we have used
sudo apt uninstall command followed by multiple package names. All the package names are separated by a blank space.
Suppose, We want to remove TeamViewer as well as Zip from our system then we will have to run the following code-
sudo apt uninstall teamviewer zip
After running this code, we will have to enter the password and within a few seconds, these two applications will be removed.
Note: If you are getting an error and you are unable to uninstall the programs then you need to use the “remove” subcommand instead of the “uninstall” subcommand.
Let’s have an example:
sudo apt remove teamviewer zip
Try using this command. We are sure it will work for you.
When we remove packages from Ubuntu or any other Linux-based operating system we have to remove the dependencies also especially when we have to re-install the package again. But the best thing about
sudo apt uninstall we don’t have to remove the dependencies manually if we remove software packages using this command.
For example, You have installed TeamViewer, which depends on many libraries like libc6, libdbus-1-3, libexpat1, and many more. So if you choose to uninstall or remove the TeamViewer package using the
sudo apt uninstall command then you will not have to waste your time in remove TeamViewer’s dependencies manually.
Remove Packages Without Using
sudo apt uninstall Command
sudo apt uninstall command doesn’t work always. Especially, when you don’t have installed the package using the “apt” package manager. In such a case, The other method of Uninstalling a program may help you.
Like the packages installed using .deb files can be installed using
So if you have Installed a package using a .deb file and you want to remove it then you can do so by running the following command:
sudo dpkg --purge package_name
Here from the syntax, replace the “package_name” with the actual package name or program name. Like, if you want to remove TeamViewer then you will have to run the following command
sudo dpkg --purge teamviewer
Similarly, if you have installed a package using the snap package manager then you will have to uninstall it using the snap command only. Let’s see the syntax:
sudo snap remove package_name
For example, if you have installed chromium using the snap package manager then you can remove it using the following command.
sudo snap remove chromium
snap remove chromium command will not only remove the package only but also it will remove configuration files as well as associated data.
sudo apt uninstall is an easy and quick way to remove packages from Ubuntu. But it might not work for some users due to any reason. In such a case, if you are unable to uninstall a program using the “uninstall” subcommand of “apt” then you will have to use the “remove” subcommand. You will have to run
sudo apt remove command.