How to uninstall or remove package from Ubuntu

If you're a new Ubuntu user and are experiencing storage issues, you've come to the right place. Ubuntu's command line interface makes it easy to install and uninstall packages, but with so many packages available, it can be difficult to know which ones are necessary. This guide will help you identify and remove any unnecessary packages, freeing up space on your system and improving overall performance.

In this article we will discuss diffrent ways to uninstall a package from the Ubuntu system.

Using APT

You can uninstall or removes an installed package itself from Ubuntu through the terminal by:

$ sudo apt-get remove <package-name> 

Uninstall package including dependent package

If you would like to remove an package and it's dependencies which are no longer needed from Ubuntu,

$ sudo apt-get remove --auto-remove <package-name> 

Uninstall package including purge command

If you use with purge options to package all the configuration and dependent packages will be removed.

$ sudo apt-get purge <package-name> 

If you use purge options along with auto remove, will be removed everything regarding the package, It's really useful when you want to reinstall again.

$ sudo apt-get purge --auto-remove <package-name>

Uninstalling unnecessary packages

When you install new software on your system, your package management may download and install additional packages called dependencies. These packages help the software run correctly, but they may remain on your system even after the main package is installed. As a result, it is recommended to periodically clear out any unnecessary packages from your system to save space and improve system performance. You can do this by using the command sudo apt-get autoclean, which removes any unused packages. It's a quick and easy way to keep your system clean and efficient.

Run the below mentioned command to remove unused packages:

$ sudo apt autoremove

Using dpkg

Another way to remove packages from the system is by using the dpkg command. This tool, which is a part of the Debian package manager, allows you to install, build, uninstall, and manage packages. With dpkg, you can uninstall packages with ease, and it's a great alternative to the more conventional sudo apt-get remove command:

$ sudo dpkg –r <package-name>

Using snap

The Snap package manager is a relatively new way to install and manage applications on Ubuntu. While it's not the primary method for handling packages, it's included in all current versions of Ubuntu. To remove packages installed via Snap, you'll need to use the snapcommand, which works independently of the apt command. The syntax for removing a Snap package is as follows:

$ sudo snap remove <package-name>

I hope this post was helpful to you.

Leave a reaction if you liked this post!