How Can You Completely Remove a Package From Ubuntu 24.04

In Ubuntu 24.04, simple package removal is sometimes not enough. Specifically, configuration settings and files may occupy the system space and impact the performance.

This blog demonstrates how to completely remove a package from Ubuntu 24.04.

1. Using the APT Tool

In all Debian-based Linux distros, the packages are usually managed and installed through APT.

To completely remove the package that is installed through APT, go through the given instructions.

Step 1: View Installed Packages

First, view the installed packages through the “apt list” command:

sudo apt list --installed
viewing installed packages with apt list command

Step 2: Remove Package

Now, remove the package that is installed through APT: 

sudo apt remove python3 -y

Here, the “-y” option gives the essential permissions to remove the “python3” package and free up the disk space:

removing python3 package using apt remove

Note: The above command only removes the “python3” package but additional dependencies and configuration still exist on the system.

Remove the package along with all configurations files and settings via:

sudo apt purge python3 -y
removing python3 package completely using apt purge

Step 3: Remove Unused Dependencies

Remove additional dependencies or packages that are installed with package installation:

sudo apt autoremove -y
removing extra dependencies and packages with apt autoremove

Step 4: Remove Local Repositories

Lastly, remove the orphan or unused files using:

sudo apt clean
removing orphan files with apt clean

2. Using Snap Store

You can also install packages through the Snap store on Ubuntu 24.04.

However, to completely remove the package that is installed from the Snap store, check out the listed steps.

Step 1: View Installed Packages

First, list the packages that are installed from the snap store:

sudo snap list
viewing snap packages with snap list

Step 2: Remove Package

Then, remove the package from Ubuntu 24.04 through:

sudo snap remove spotify
removing spotify using snap remove

Likewise, this removes only the package from the system but configuration files and snap stay on the system.

Moreover, to completely remove the package along with configurations, execute the below command:

sudo snap remove --purge spotify
removing package completely using snap remove

This removes all additional configuration and package snap along with the package from the system:

3. Using the dpkg Command

The “dpkg” is a Linux utility utilized to install and manage the Debian packages. 

To completely remove the package along with configuration files and dependencies with “dpkg“, execute:

sudo dpkg --purge vim
removing package completely using dpkg purge

So now you know how can you completely remove a package from Ubuntu 24.04 using the “sudo apt remove –purge <package name>”, “sudo apt autoremove”, and “sudo apt clean” commands.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top