How to Uninstall a .Deb Package in Ubuntu?
This is one of the few things which I often needed to do a quick google search for. So decided to create a post for this so I can come back later if needed.
The installtion process of a
.deb package is quite straightforward we just need to do
sudo dpkg -i ./path/to/the/package.deb
The name of the program itself does not matter here. But if we want to uninstall the same package, we can't do that just by pointing to the package path. We have to specifically specify the program name that got installed.
So The first step is to find the program name of the installed
.deb package. We look for the program name by listing all the installed local packages that includes a certain word. Let's say we installed the Chrome browser through their
.deb package. And now if we want to uninstall it we can look for the keyword
chrome in our locally installed packages by doing
dpkg --get-selections | grep chrome
Now that we are aware of the program name. We can uninstall it using the following command
sudo dpkg --purge google-chrome-stable
And that is it. The Chrome is now removed from your system.