It’s always a pain to uninstall an application on Linux distros. The most important reason being, there are multiple installation methods. You can install an app from the Apt repository or the Snap repository. You can also use the universal packaging method like Flatpak or AppImage. To top all of these, you can also sideload, compile, and install applications. These dozens of ways to install an app leads to multiple ways of uninstalling them as well. So, covering all of these here’s a list of methods explaining how to uninstall an app in Ubuntu.
How to Uninstall An Application In Ubuntu
Generally, there are 2 ways to uninstall an app in Ubuntu – Command-Line or GUI. In case you are not comfortable with the terminal, jump over to the GUI section which is frankly the easiest way to uninstall an app on Ubuntu. Let’s start with the command-line way first.
Command-Line, basically, means using the terminal to uninstall an app. However, to do that, we need more information. First, the repository you have used to install the app and second, the package name. Now, there are 3 most popular repositories on Ubuntu that you might have used.
Now, in case you don’t know what repository was used to install the app, there’s no single command to figure that out. However, you can always search the individual repositories and find out the package name. Let’s start with the apt repository first.
In order to uninstall an app, we would first require the package name. To get the package name, we need to search the installed list of the apt repository.
Let’s assume we’re searching for an application named Chromium and I would let my search word be “chrom*”. So, this way I am covering all the packages whose name starts with “chrome”. Use the following command to search the list.
sudo dpkg --list chrom*
Here, the second search result is Chromium which is the application I am looking for. But the status of the package is “un”. This means it’s not installed via the apt repository. So, roughly, ii means installed, un means unknown and in means not installed.
The basic command to uninstall an app downloaded from the apt repository is as follows. Since we cannot find chromium in the apt repository, let’s consider the package Vim that we intend to uninstall.
sudo apt remove vim
Now, the above command is fairly basic and only removes the app. It doesn’t touch any of the configuration files and other dependencies installed.
For instance, suppose a wallpaper app. Now, this wallpaper app would downloads images to a directory from the Internet to apply as your wallpaper. These directories can be considered as configuration files. Additionally, it would require small utilities to scrape the Internet and download the files. These utilities can be considered as dependencies.
Now, if I just remove the wallpaper app, all those configuration files and dependencies would remain untouched. Hence, to clear all of these you can use the following command.
sudo apt purge
In case you want to keep the configuration files, you can remove the purge option from the above command.
In case your app doesn’t exist in the apt repository, chances are you might have installed it via snap. Again, similar to the apt repository, to uninstall the application from the snap, we would need the application package name. Below is the command to search the package name in the snap repository.
sudo snap list | grep chrom*
Here, you can see there’s a single result for chromium. Unlike apt search, the snap search only shows the list of packages installed on the system. In my case, I have installed chromium using snap and it shows up via the command. The package name of the application is “chromium”. Similar to Apt, the simplest command to remove a Snap package is as follows.
sudo snap remove chromium
Unlike apt, snap by default removes all the user data, configuration files, and dependencies. Though it creates a snapshot of these and maintains it for 31 days. In case you want to omit this snapshot, use the following command.
sudo snap remove --purge chromium
In case both of the above-mentioned repositories don’t contain your application’s package name, chances are it might be installed via flatpak. Having said that, there are rare chances that you might be using Flatpak on Ubuntu instead of Snap and Apt.
Anyways, to search the flatpak repository, use the following command. Again, we are considering the same application called Chromium.
flatpak list | grep chrom*
Here, the search result is empty. This means I haven’t installed the application via Flatpak. In case you get your intended application below is the command to uninstall the application via Flatpak. For this instance, we are considering the Spotify application.
sudo flatpak uninstall com.spotify.Client
Flatpak removes all the configuration files and user data as well. But, it still doesn’t clear unused packages and dependencies. To do that, use the following command.
sudo flatpak uninstall --unused
Ubuntu Software Center
The Ubuntu Software Center supports both the apt and the snap repository. Hence, Ubuntu Software is the central most important place wherein you can find all the packages irrespective of the repositories. To view your installed apps, open the Ubuntu Software application, and switch to the “Installed” tab.
You can browse through the list and click on the Remove button next to it to uninstall the application.
In case the application doesn’t show up in any of the above-mentioned methods, you might have installed it from GitHub or any third-party source. These apps might have been compiled and sideloaded via the terminal or installed via a shell script. In all these cases, you are at the mercy of the app developer to uninstall it. Visit the GitHub Wiki of the app or the website and you should find the uninstall command at the bottom.
With the release of Ubuntu 20.04, Ubuntu has been pushing the snap store more than Debian’s apt store. You can read more about the changes in Ubuntu 20.04 from the linked article below. For more issues or queries, let me know in the comments below.