Not all applications installation and uninstallation go smooth. Sometimes application install/uninstall get interrupted or frozen, leaving a traces of the program in the computer. These traces are enough for elementary OS to think the application is installed and it won’t even let you reinstall the application. So you are struck with a program that won’t work.
The ‘Software Center’ isn’t useful in such case as the program doesn’t show up in the list assuming it was installed from here. Time to go the command line way to remove the corrupt program completely. We shall use the PURGE command. In my test PC, the application ‘Elementary Tweaks’ got partially uninstalled and I’m going to use this scenario as an example.
Completely Remove Partially Installed Program
STEP 1: The first thing to know is the installed package name of the program you want to remove. Go to ‘Applications’ and launch ‘Terminal’. Type the following command and hit enter. Make sure to replace [program name] with your program’s name.
sudo dpkg -l [program name]*
In my example, I will search for elementary-tweaks.
sudo dpkg -l elementary-tweaks*
In my case the package name is exactly the same. It may not be the same in your case. You will see the package name listed in the Terminal along with Name, Version, Architecture, and Description.
STEP 2: The next step is to use PURGE and remove the installed package. The generic format is:
sudo dpkg --purge [package name]
Replace the [package name] with your package name.
For my scenario the command looks like this:
sudo dpkg --purge elementary-tweaks
That’s it. The program should be completely gone by now. Did it work for you? Do let us know in the comments below.