All Debian-based distributions, including Debian, Ubuntu, and Linux Mint, use the Deb installation package format. Installing Debian packages is one of the simplest aspects of using Linux, but things get tricky when it comes to uninstalling them. You have 6 multiple options to remove deb packages. So we'll show you an in-depth guide on uninstalling deb packages. Let's begin by getting a list of installed packages.
List Installed Packages Using Dpkg
We'll use the dpkg -list
command to display all installed packages. This step is important because we frequently don't know the full name of the package we want to remove, and if we use the incorrect name, we get an error saying, "Unable to locate the package." You can skip this step if you know the package's exact name.
You may also be interested in: Uninstall a Deb File Installed With Dpkg
To list all installed packages, open the Terminal and type the following command: dpkg –list
Scroll down until you find the package you want to uninstall. In this case, assume we want to remove the "TeamViewer" package.
Also, we will use the same package for all removal demonstrations below.
Remove Deb Packages in Linux
In this section, the different methods on how to uninstall deb packages are being discussed. Continue reading to learn more about these various approaches.
Method 1: Uninstall Packages Using Software Center
The first method applies only if you have any software installed and does not apply to all Debian packages, such as libraries and dependencies. Follow the steps below to remove deb packages using the Software Center.
- Step 1: Click Activities in the lower left corner and type software. On the first result, press Enter.
- Step 2: Click on Installed and scroll down until you find the deb package you want to uninstall. When you've located that package, select Remove.
- Step 3: You will be asked again if you want to remove it. When you click on remove, it will prompt you for your password. Enter your password, and the package will be removed.
Method 2: Delete Applications Using apt Command
Many users believe that apt
and apt-get
are interchangeable but they are not. They may work similarly with similar syntax, but they are still distinct.
- Execute the following syntax to list the installed deb packages using apt:
apt list –installed
- Run the following command to remove the deb package without removing its configuration files and dependencies:
sudo apt remove teamviewer
- Enter the following command to remove binaries, configuration files, data, and dependencies:
sudo apt purge –auto-remove teamviewer
- It will ask for your permission, and you can remove it by adding -y to the end of the command.
Method 3: Uninstall Deb Packages Using apt-get
You can remove deb packages with the apt-get command, but you'll need to use some parameters, which we'll review later. Because we need to remove packages, we'll use the "remove
" and "-purge
" parameters.
The first parameter, "remove
," will remove deb packages but keep all configuration files, but we also want to remove configuration files, which is why we used the second parameter, "-purge
," which will also remove configuration files.
- To remove required packages with
apt-get
, run the following command:sudo apt-get –purge remove teamviewer
- It requests our permission to remove the package (TeamViewer), but if you want to automate this process and avoid entering your password, add -y to the end of the command.
sudo apt-get –purge remove teamviewer -y
- If you want to uninstall deb packages without "
remove
" parameters, use the "-purge
" parameter. It will delete any binaries and configuration files associated with our desired package, in this example, the TeamViewer. - You can use the given command to only use the "
-remove
" parameter.sudo apt-get purge teamviewer
- Another case is when we only use remove, which deletes deb packages while keeping configuration files and data. If you only want to remove a package while keeping the files, use the following command:
sudo apt-get remove temviewer
Method 4: Use Synaptic Package Manager To Remove Deb Applications
Synaptic Package Manager is regarded as the best tool for managing your applications via a graphical user interface. Unlike the software center, where you cannot remove dependencies, Synaptic makes it simple.
- Step 1: It is pre-installed in Debian, but if you have removed it, you can reinstall it with the following command:
sudo apt install synaptic
- Step 2: After installing Synaptic, go to Activities and search for Synaptic. When you press Enter on the first result, Synaptic will launch.
- Step 3:Click the Search button and enter the deb package name you want to uninstall. If you press Enter, you'll get similar results.
- Step 4:We must locate the installed deb package, highlighted in green in the checkbox. Right-click the package and select Mark for complete removal.
- Step 5:When you click the Apply button, a list of all packages will appear. To remove, click Apply again.
- Step 6:It will walk you through the package removal process.
Method 5: Uninstall Packages Using dpkg
Linux has always been about choice; you can perform almost any task in multiple ways. As previously discussed, there are various ways to uninstall deb packages, and another way to uninstall packages is by using dpkg.
- Step 1:We can easily remove packages with the following command:
sudo dpkg –remove teamviewer
- Step 2: You can also use -r instead of -remove because they are interchangeable. It will resemble the following command:
sudo dpkg -r teamviewer
Method 6: Uninstall Broken Packages
As Linux users, we frequently encounter situations in which our packages are not properly installed, resulting in malfunctioning, and we frequently fail to locate that package because it is not properly installed.
However, you can easily resolve all issues that may arise as a result of broken packages by using the following commands:
- The following command will clear the old cache of programs that are older than the current version installed, as well as unnecessary files and dependencies that are no longer needed.
sudo apt-get clean && sudo apt-get autoremove
- This command will repair all broken dependencies and resolve package corruption issues.
sudo apt-get -f install
- Running this command will resolve any remaining issues.
sudo dpkg –configure -a
How To Recover Packages That Have Been Accidentally Deleted in Linux
After learning about the various methods to uninstall deb packages from your Linux system, it's important to remember that data loss is always possible, especially if you accidentally delete important files during the process.
However, there's no need to panic as numerous procedures, and software options are available to recover deleted files in Linux. It's best to choose a top-rated recovery tool to assist you in restoring your data. Thus, we highly recommend Recoverit Linux Recovery. This recovery tool is designed to help Linux users recover deleted files, folders, and partitions, and it can recover all kinds of data loss.
Wondershare Recoverit - Your Safe and Reliable Linux Recovery Software
5,481,435 people have downloaded it.
Recovers lost or deleted documents, photos, videos, music, emails, and other 1000+ file types effectively, safely, and completely.
Compatible with all mainstream Linux distros, including Ubuntu, Linux Mint, Debian, Fedora, Solus, Opensuse, Manjaro, etc.
Assists in 500+ data loss scenarios, such as deletion, disk formatting, OS crash, power outage, virus attack, lost partition, and many more.
The simple point-and-click interface allows you to recover data from Linux hard drives in just a few clicks.
Works through a remote connection. You can recover lost data even when your Linux device is crashed.
Your data can be recovered in three easy steps with Recoverit Linux Recovery.
Recent Videos from Recoverit
View More >Step 1Tap on Linux Recovery
Launch Wondershare Recoverit after downloading and installing it on your pc. Then click NAS and Linux > Linux Recovery.
Step 2Connect the Linux computer Remotely
A new window will appear on your screen, as shown below. Enter the necessary information to establish a remote connection between the software and your Linux device.
Once the remote connection has been successfully created, Recoverit will automatically scan for missing files in your Linux computer.
Step 3Recover Deleted/Lost Files
The best feature of Recoverit is that you can stop scanning whenever you find a file you want to restore. On the bottom bar, the scanning status is displayed. Besides, you can preview the files to ensure they are the ones you want to recover. Finally, click the Recover button to save the files to a safe location.
The software will prompt you to choose a location on your PC for the recovered files. Click Recover to get the restored data.
For Windows Vista/7/8/10/11
For macOS X 10.10 or later
FAQs
How do I remove a program on Debian?
To remove the required package from Debian, use the following command to remove the configuration file and data.
sudo apt remove <package name>
Run the following command to remove a package and its dependencies:
sudo apt purge –auto-remove <package name>
How do I purge a Debian package?
A Debian package can be purged in a specific way that removes configuration files and binaries associated with the package. To remove a package from Debian, type the following command:
sudo apt purge <package name>
How can I totally uninstall a software in Linux?
If you want to completely remove the package, including all dependencies, data, configuration files, and binaries. To completely remove the package from Linux, use the following command:
sudo apt purge –auto-remove <package name>
Conclusion
The article outlines six methods to uninstall deb packages on Linux, including using apt-get, apt command, synaptic, dpkg, and Ubuntu software center. In addition, it's important to have a reliable data recovery solution like Wondershare Recoverit Linux Recovery in case of accidental file deletion.