How to uninstall a package on Ubuntu
To install, update, or uninstall the packages on Ubuntu, we use the APT package manager, so there are different options that are used to uninstall the packages on Ubuntu. These options are listed down:
- Using the remove command
- Using the purge command
- Using the auto-remove command
- Using the dpkg
- Using the snapd utility
Option 1: Uninstall a package on Ubuntu using the remove command
We can use the “remove” command to uninstall the package on Ubuntu, but this option of the apt package manager will only delete the package without deleting its configuration files.
For example, we will use this option to remove the package of Vim:
You can delete any package on Ubuntu by replacing the “vim” with the name of the particular package in the above command.
Option 2: Uninstall a package on Ubuntu using the auto-remove command
Another option that is used with the apt package manager is “auto-remove” and using this option we can remove the configuration files and packages which are of no more use for a long time, and use this command:
Option 3: Uninstall a package on Ubuntu using the purge command
There is an option used mostly with the apt package manager is of “Purge” which not only removes the package but also all the configuration files associated with that specific package.
For example, we will again uninstall the Vim package using the command:
Option 4: Uninstall a package on Ubuntu using the dpkg command
Other than the apt package manager, we also have a dpkg manager that is also used to manage the packages on Ubuntu, especially the Debian packages, so we can also uninstall any package using the dpkg with its “-r” option.
For example, we want to uninstall the vlc media player using the command:
Option 5: Uninstall a package on Ubuntu using the snapd utility
In the latest version of Ubuntu which is the Jammy Jellyfish, the snap utility is being installed by default which is used to install packages from the snapcraft store. The packages that are downloaded and installed using the snapd utility can only be uninstalled by using the snap utility.
For example, we will uninstall the rocketchat-server using the snap command:
Conclusion
To free up the space on Ubuntu so that new packages can be installed as well as the other programs can be run smoothly, we have to uninstall the packages which are of no use. In this write-up, different techniques are being explored using which we can uninstall the packages on Ubuntu.
Discover more from Ubuntu-Server.com
Subscribe to get the latest posts sent to your email.