Linux, like any other OS, has many flaws and one of them seems 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 software 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.
Apart from uninstalling software packages, there are more things you can do with these useful commands for Ubuntu.
Get the software 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. 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 on Ubuntu
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. For example, here is how you can install and uninstall Firefox on Ubuntu.
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
Completely uninstall software package
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
Uninstall program dependencies
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, it is always better to run the following command.
sudo apt-get autoremove
Read Next: 5 Popular Mac and Windows Apps for Linux
I had ubuntu 16.4 and I installed 20.4. Now I have problems,
Hoping you can tell me what to do now??????
Need some help.
I tried this, it does indeed delete the app. However it doesn’t delete certain files and leaves “residue” that takes long to delete.