Linux, like any other OS, has many flaws and one of them seem to be the backend of app installations. Installing apps is much easier than it is on Windows. most apps you’ll need will only take clicking on an install button once. Some with a single command that you can copy and paste from somewhere on the internet. You don’t have to worry about adware and other things. When an app is installed though, it places files all over. It will also often install many dependencies which it requires. Ubuntu, being based on Linux has similar problems. When you uninstall an app, this leaves a lot of junk on the storage. But there is a way to completely uninstall apps along with all their data using the command line on Ubuntu.
Get the package name
Software on Linux systems is distributed as packages. These packages have a unique name and when uninstalling or installing a package via the command line, you need to know the exact name of the package. Since we want to uninstall an app, it’s logical to assume it is already installed on the system. You can get a list of all the installed packages on the system using the
dpkg --list command. So launch a Terminal and enter the command.
You should see quite a long list of package names along with their version number and a small description as shown in the screenshot above. Most apps will install several packages so it is essential that you’re able to identify the main app package. For example, in the above screenshot, you can see yelp and yelp-xsl. If you want to remove them, you should remove yelp because it is obviously the main package of the two.
Uninstall an app
To uninstall an app, we can use the
apt-get command, which is also used to install apps, followed by
remove. Of course, the
sudo command needs to be placed before everything else to carry out superuser tasks. There are two options you’ll still have. You can either keep the app’s configuration settings if you want to reinstall it later or you can completely remove the app as well as its data or configuration settings.
Read also: 3 Lightweight Desktop Environments for Linux
Keep personalized settings
If you want to reinstall an app later, you may want to keep the settings so that when you install it again, the program is already fine-tuned to the way you like it. So the command to use is as follows.
sudo apt-get remove package_name
In the command above, replace
package_name with the exact name of the app package that you want to uninstall. For instance, to uninstall VLC Media Player, which has the package name
vlc, the command will be
sudo apt-get remove vlc
Sometimes your personalized settings are what may have caused you to want to uninstall an app. Keeping them around might not be a great idea then even if you want to reinstall the app later. In that case, or if you don’t want to reinstall the app again, you can opt to completely remove an app along with its configuration settings. You’ll need to use the
--purge command for this.
sudo apt-get --purge remove package_name
So to uninstall VLC Media player completely, for instance, the command to use would be
sudo apt-get --purge remove vlc
As we mentioned earlier, sometimes an app will install a bunch of other packages that are required by the app to properly function. For instance, if you install any app developed for the KDE Plasma desktop environment, the app will install a bunch of KDE packages that it depends upon. You may not need these packages anymore when you’ve uninstalled the app. Uninstalling them does no harm to the proper functioning of other apps on your PC. That’s mostly thanks to the
autoremove command which finds out such obsolete software packages that are not being used by any apps and removes them from your system. After uninstalling an app itis always better to run the following command.
sudo apt-get autoremove