How To Completely Remove a Package From Ubuntu?

As a Linux System administrator, you must deal with many package installations and management of these tools. While installing tools and packages in Linux distributions is quite easy, uninstalling and removing all their files and dependencies is tricky.

Linux distributions install and uninstall packages, dependencies, and tools using a specific package manager. However, a distribution like Ubuntu can have multiple package managers that can be used to install tools. Therefore, using the same package manager to uninstall a package is better. 

This guide will show you different ways to uninstall complete packages and their dependencies from your Ubuntu Machine.

Method 1: Use the Ubuntu Software Center to Uninstall Packages

The easiest way to uninstall a tool or package from your Ubuntu machine is to use its Ubuntu Software Center. However, this method doesn’t work for all of the packages as it mainly lists “tools.” However, open up the Ubuntu Software Center from the Desktop and then shift the tab to “Installed”:

After that, inside the “installed” tab, you will be able to see the list of all the installed packages and tools:

Once you have found the package you want to remove, click on the “Uninstall” button next to its name:

Doing this will show a confirmation prompt and will require you to click on the “Uninstall” button once more:

This will initiate the uninstallation process.

Method 2: Use the “apt remove” Command to Uninstall Packages

The apt is the most used package manager to install packages and their dependencies. You can use the same apt package manager to remove packages from your Ubuntu machine. However, this will require you to know the package’s exact name you want removed. 

If you are unaware of the package name that you want to uninstall, run the following command:

sudo apt list --installed

Executing this command will list down all the packages that are installed on your Ubuntu:

If you want to remove the “unzip” package, use the following command template:

sudo apt remove <package_name>

For “unzip” the command will become:

sudo apt remove unzip

Run the command in a terminal session, and the uninstallation process will start:

Note: Remember that the “apt remove” command will uninstall the package that has been specified. However, it will not remove the configuration files or the registries from the Ubuntu machine.

Method 3: Use the “apt purge” Command to Uninstall Packages

An alternative to the “apt remove” command is to use the “apt purge” command, as it will remove the dependencies, configuration files, and the main package. To utilize this command, use the following command template:

sudo apt purge <package_name>

For instance, to remove the unrar package from your Ubuntu machine, you will have to use the command:

sudo apt remove purge unrar

Dracula Servers FreeRadius VPS

If you’re looking for a reliable and high-performance VPS solution for FreeRadius, consider Dracula Servers’ FreeRadius VPS service. Dracula Servers offers a robust and dedicated hosting environment tailored for FreeRadius applications, ensuring optimal performance and reliability.

With Our VPS, you can experience seamless integration with FreeRadius, allowing you to manage authentication, authorization, and accounting for your network services efficiently. Dracula Servers provides a user-friendly platform coupled with top-notch support, making it an excellent choice for those seeking a hassle-free FreeRadius hosting experience.

For more information and to get started, visit Dracula Servers FreeRadius VPS.

Method 4: Use the snap Command to Uninstall Packages

As mentioned above at the start of this guide, if you have used the snap store to install packages on your Ubuntu machine, then you will have to use the snap command to uninstall them. 

To use the snap package manager to uninstall, you need to use the following command template:

sudo snap remove <package_name>

However, to show the list of packages that can be removed from your Ubuntu machine, run the following command:

sudo snap list

To remove a package like “firefox,” the command will become:

sudo snap remove firefox

After executing the command, wait for the uninstallation process to complete:

Method 5: Removing Unused Dependencies

If you have removed the packages from your Ubuntu machine using the “apt remove” command, then there are unnecessary dependencies on your machine. To get rid of such dependencies, you can use the autoremove command. To use this, open up a new terminal session and execute the following command:

sudo apt autoremove

Wrap Up

Installing and Removing Packages in a Ubuntu machine can seem daunting. However, it is not that difficult. If you are a beginner, then using the GUI Ubuntu Software Center to remove tools is best. You can also use the apt package manager to remove packages from the machine. 

However, with the apt package manager, the “remove” and the “purge” option will work separately. The first one will remove the package that has been specified, while the latter will also remove its dependencies and configuration files. If you have used the snap package manager to install the package, then you will use the “snap remove” command. 

Check out More Ubuntu Tutorials Here!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
× Dracula Servers

Subscribe to DraculaHosting and get exclusive content and discounts on VPS services.