Linux has many flaws; one seems to be the backend of app installations. Installing apps is much easier than it is on Windows. While most apps can be installed by clicking an install button once, some require only a single command 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 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 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.
dpkg --list
You should see quite a long list of package names with their version number and a small description as shown in the screenshot above. Most apps will install several packages so you must be able to identify the main app package. For example, you can see yelp and yelp-xsl in the above screenshot. If you want to remove them, you should remove yelp because it is 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 keep the app’s configuration settings if you want to reinstall it later or completely remove its data or configuration settings.
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, the command will be
sudo apt-get remove vlc
Completely uninstall the software package
Sometimes your personalized settings may cause you to want to uninstall an app. Keeping them around might not be a great idea 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 with its configuration settings. You’ll need to use the --purge
command for this.
sudo apt-get --purge remove package_name
So to uninstall the VLC Media player completely, for instance, the command to use would be
sudo apt-get --purge remove vlc
Uninstall program dependencies
As mentioned earlier, sometimes an app will install a bunch of other packages required by the app to function properly. 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 may harm the proper functioning of other apps on your PC. That’s mostly thanks to the autoremove
command which finds 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