How to Remove Packages on Debian 12

Debian distribution comes with a hundred packages of various software. Software can be installed using these packages with different package managers on Debian. Similarly, installed packages can be removed from Debian using different package managers. 

When the packages are installed on Debian 12, they occupy some memory space for storing their configuration data. Also, some tasks related to packages may be running in the background of the Debian processes. 

When there is no need for the installed packages, it is recommended to remove them on Debian 12. This removal of the packages will ensure the optimization of the Hard disk and RAM of the computer. Also, the available space with the removal of the package can be utilized by some other newly installed packages. 

This post will explain several methods to remove packages on Debian 12 using the command line interface as well as the Graphical user interface. This blog will follow the outline:

  1. What are the Ways to Remove Packages on Debian 12
  2. Method 1: Remove Packages on Debian 12 Using the apt Package Manager
  3. Method 2: Remove Packages on Debian 12 Using the dpkg Package Manager
  4. Method 3: Remove Packages on Debian 12 Using the snap Command 
  5. Method 4: Remove Packages on Debian 12 Using the flatpak Package Manager
  6. Method 5: Remove Packages on Debian 12 Using the Software

Let’s start the article by exploring different removal methods for packages on Debian 12. 

What are the Ways to Remove Packages on Debian 12?

Different command line and graphical user interface methods are explained in detail for removing packages on Debian 12. 

Method 1: Remove Packages on Debian 12 Using the apt Package Manager

The apt command utility is the built-in package management tool that comes in Debian for managing the packages. It is used for installing, updating, removing, and uninstalling the packages on Debian 12. 

The general usage syntax of the apt command in Debian is explained below:

$ sudo apt [option] [package name]

Different options of the apt command can be used in the above general syntax to remove the installed packages on Debian 12. These options are explained in the examples below by removing the installed package of VLC on Debian 12. 

Example 1: Remove a Package 

To remove the package only from the Debian 12, use the “remove” option of the apt command:

$ sudo apt remove vlc

Example 2: Remove a Package with its Configuration Files

To remove the installed package including all its configuration files, use the “purge” option of the apt command:

$ sudo apt purge vlc

Example 3: Remove a Package with its Unused Dependencies

To remove the unused dependencies on Debian 12 using the “autoremove” option of the apt command, run the command:

$ sudo apt autoremove

These are the options of the apt command that can be used to remove the installed package on Debian 12. 

Method 2: Remove Packages on Debian 12 Using the dpkg Package Manager

The oldest and primary package manager for the Debian distributions is the dpkg package manager. The general syntax of using the dpkg package manager on Debian 12:

$ sudo dpkg [Options] [Package name]

Several options of the dpkg package manager that are used for the removal of the installed packages on Debian 12 are explained in examples. 

Example 1: Remove a Package 

To remove the package with the dpkg, use either its “r” option or the “remove” option:

$ sudo dpkg -r vlc

Example 2: Remove a Package with its Configuration Files

Use the “purge” option of the dpkg to remove the package with all its configuration files:

$ sudo dpkg --purge vlc

These are two options of the dpkg command to remove the installed packages on Debian 12. 

Method 3: Remove Packages on Debian 12 Using the snap Command 

The Snap is the command utility that is used to download and manage the packages from the Snapcraft store. The packages installed on Debian 12 from the snapcraft can be listed down with the command:

$ snap list

To remove the installed package from the snapcraft, use the “remove” option of the snap command:

$ snap remove vlc

The package has been removed successfully on Debian 12. 

Method 4: Remove Packages on Debian 12 Using the flatpak Package Manager

Some packages are installed from the flathub using the flatpak command utility. To remove such packages from Debian 12, use the “uninstall” option as shown below:

$ flatpak uninstall flathub org.videolan.VLC

The installed package of VLC has been uninstalled and removed from Debian 12. 

Method 5: Remove Packages on Debian 12 Using the Software

The packages which are installed from the default repository of Debian 12, can be removed using the Graphical user interface. For example, to uninstall the “VLC” using this method, open the “Software” and search for the “VLC”:

Now click on the “Uninstall” button to remove it from Debian 12:

Enter the password to proceed with the removal of the package:

The package has successfully been removed from Debian 12.

These are the five different methods for removing the packages on Debian 12. 

Conclusion

To remove the packages on Debian 12 use the remove option of the apt command as well as the dpkg command utility. The packages installed from Snapcraft and Flathub can be removed from Debian 12 using the remove and uninstall options of their respective package managers. 

This post has explained all the above-mentioned command line methods with the demonstration of the example. It also explained the GUI method for removing the packages on Debian 12.