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.
Table of Contents
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
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:
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
Step 3: Remove Unused Dependencies
Remove additional dependencies or packages that are installed with package installation:
sudo apt autoremove -y
Step 4: Remove Local Repositories
Lastly, remove the orphan or unused files using:
sudo 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
Step 2: Remove Package
Then, remove the package from Ubuntu 24.04 through:
sudo snap remove spotify
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
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
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.
Software engineer with 3+ years of expertise in Linux, Windows, and multiple programming languages. Proficient in Docker, Kubernetes, and Elasticsearch. Passionate about building scalable systems and helping others through clear, problem-solving guides