How to Remove/Uninstall .deb Package on Debian 12?
A .deb package is a file that contains the executable files, libraries, and documentation of a software program. It is compatible with Ubuntu/Debian-based Linux distributions (including Debian 12). Users may want to remove or uninstall a .deb package from the Debian system, either to free up disk space or to resolve some issues. It speeds up the Debian system to perform other installation/configuration tasks.
Based on its significance, this article will explain different methods to remove or uninstall a .deb package on Debian 12.
How to Remove/Uninstall .deb Package on Debian 12?
A .deb package is a file that contains the software and metadata for installing applications on Debian-based Linux distributions. To remove/uninstall the .deb Package on Debian 12, use the below-stated methods:
- Method 1: Using dpkg
- Method 2: Using apt
- Method 3: Using Software Center (GUI)
- Method 4: Using Synaptic Package Manager
Let’s begin with the official one.
Method 1: Remove/Uninstall a .deb package on Debian 12 Using dpkg
The dpkg tool is a low-level utility that can remove, inspect, or install .deb packages. To remove/uninstall a .deb package on Debian 12 using dpkg, follow these steps:
Step 1: List All Installed Packages
To remove a .deb package with dpkg, users require the package name. For this, use the “dpkg -l” command to list all the installed packages on the system and find the one to remove:
dpkg -l
Search Specific .deb Package
Users can also target the specific package to remove the .deb package from the repository. For instance, enlist the “nano” package:
dpkg -l nano
Step 2: Remove .deb Package
Then, use the “dpkg -r” command to remove the package. For instance, remove the “nano” text editor, and run the below command:
sudo dpkg -r nano
It displays some messages about dependencies or configuration files that are also removed or modified.
Step 3: Verify Removed .deb Package
To verify that the package is successfully removed, type “dpkg -l” by specifying the package name and check the output:
dpkg -l nano
Optional: If the package is not installed, see a message like “dpkg-query: no packages found matching package-name”. To fix it, reinstall the package or use the “sudo apt –fix install” command.
That is all from this section.
Method 2: Remove/Uninstall a .deb package on Debian 12 Using apt
The apt tool is a high-level utility that can manage packages and their dependencies. To remove/uninstall a .deb package on Debian 12 using apt, follow these instructions:
Remove a .deb Package with apt Using apt remove
The apt remove command removes the package but leaves its configuration files intact. For example, to remove the “cron” and its configuration files, execute the below command:
sudo apt remove cron
Remove a .deb Package with apt Using apt purge command
The apt purge command removes the package and its configuration files as well. For example, to remove the nano as well as its configuration files, you would execute the below:
sudo apt purge cron
It uninstalls the package as well as dependent packages that are no longer needed.
Both commands remove any packages that depend on the package you are removing unless they are required by other packages.
Remove Related Packages/Dependencies
Users can utilize the -s or –simulate option to see what packages will be removed before actually removing them. For instance, to simulate removing the nano text editor as well as its configuration files, run the below command:
sudo apt purge -s nano
It removes any leftover files or settings related to the package.
Remove/Uninstall .deb Package (Completely)
To remove/uninstall .deb Package along with dependent packages and temporary files, use the “autoremove” utility by mentioning the package name such as “nano”:
sudo apt autoremove nano
Update Available Packages
To update the list of available packages as well as dependencies, type the below command and press Enter.
sudo apt update
Clean Up Cache Downloaded Packages
To clean up the cache of downloaded packages, type the below command and press Enter
sudo apt clean
You have successfully removed or uninstalled a .deb package on Debian 12 using apt.
Method 3: Remove/Uninstall a .deb Package on Debian 12 Using Software Center (GUI)
To remove or uninstall a .deb package on Debian 12 using GUI, you can follow these steps:
Step 1: Open the Software Center
First, open the Software Center application from the main menu or the desktop launcher:
Step 2: Search/Type .deb Package Name
In the search box, type the name of the package users want to uninstall/remove or browse the categories to find it:
Step 3: Remove .deb Package
Now, click on the package to open its details page. Now, click on the Remove button on the right side of the page. Enter your password if prompted and confirm the removal:
Wait for the process to finish and close the Software Center.
Method 4: Remove/Uninstall a .deb Package on Debian 12 Using Synaptic Package Manager
Synaptic is a graphical tool that allows users to manage the installed packages on their system. If you want to remove or uninstall a .deb package on Debian 12, use the synaptic package manager. Here are the steps to follow:
Step 1: Open Synaptic
Open Synaptic from the application menu or by typing “sudo synaptic” in a terminal:
Step 2: Type Package Name
In the search box, type the package name such as “ansible” to remove or uninstall from the system:
Step 3: Select .deb Package
Select the package from the list and right-click on it. Then, hit “Removal” or “Complete Removal” depending on whether users want to keep or delete the configuration files of the package. Finally, hit “Apply” on the toolbar and confirm the changes:
For confirmation, hit the “Apply” button again as below:
Wait for the process to finish and close the synaptic.
You have successfully removed or uninstalled a .deb package on Debian 12 using the synaptic package manager.
Conclusion
To remove or uninstall a .deb package on Debian 12, use the dpkg, apt, Software Center, and synaptic package manager. To remove/uninstall a .deb package on Debian 12, type “sudo dpkg -r package-name”, where package-name is the name of the .deb file to remove. To remove/uninstall a .deb package on Debian 12, type “sudo apt remove package-name”. Optionally, purge the package configuration files by typing “sudo apt purge package-name”. It removes any leftover files or settings related to the package. Also, use “Software Center” or “Synaptic” to remove or uninstall a .deb package on Debian 12 using GUI.