How Can You Completely Remove a Package on Ubuntu?

Linux and its distributions offer several ways to install the software packages, such as  “apt”, “snap”, and “flatpak” package managers, from official repositories and manual installation. These package managers also install some additional dependencies and configuration files. Due to this, the system storage is filled with unnecessary files and dependencies that slow down the system’s performance.

This post illustrates all possible ways to completely remove a package on Ubuntu with the following guidelines:

How to Completely Remove a Package Installed Using “apt”?

Ubuntu-based distributions commonly use the well-known “apt” package manager for installing, removing, updating, and upgrading software packages. 

Simply execute the “autoremove” command with the “purge” keyword to completely remove the “Scribus” application from the system along with its dependencies:

$ sudo apt --purge autoremove scribus

The “scribus” package has been completely removed from the system.

How to Completely Remove a Package Installed Using “snap”?

Snap is another package manager that comes with a bundle of software packages along with their dependencies. Many packages can be installed from this source. 

If you want to remove a package installed using snap, then use the command: 

$ sudo snap remove xournalpp --purge

The “Xournal++” tool has been completely removed.

How to Completely Remove a Package Installed Using “flatpak”?

Flatpak is another package manager that allows users to download packages from multiple repositories known as “remotes”. It stores its files in the “/var/lib/flatpak/app” directory.

Execute the following command to completely remove the “Arduino IDE” application from Ubuntu 22.04:

$ flatpak uninstall --delete-data cc.arduino.arduinoide

The “Arduino IDE” has been completely removed from Ubuntu 22.04.

Note: Any package installed by the “apt”, “snap”, and “flatpak” can only be removed by that specific package manager. Suppose the “apt” package can not be removed using the “snap” or vice versa.

Conclusion

To completely remove an apt, snap, and flatpak package, use the commands “sudo apt –purge autoremove <package-name>”, “sudo snap remove <snap-name> –purge”, and “flatpak uninstall –delete-data <package-id>” respectively. The “apt” and “snap” comes by default however, the “flatpack” needs to be installed. This guide has provided all the possible approaches to remove the package from Linux completely.