Suppose I download a .deb package from a website and install it. (I assume that when I double click the .deb file, the package is installed through a GUI that interfaces with dpkg right?)
How can I uninstall it?
Suppose I download a .deb package from a website and install it. (I assume that when I double click the .deb file, the package is installed through a GUI that interfaces with dpkg right?)
How can I uninstall it?
Manually installed packages appear in the Software Centre, along with all the others. Just search the software centre for your package and remove it there.
You may have to click on "Show N technical items"
Along with this, there are a few other methods:
Synaptic:
Click the Apply button.
This will have the benefit of listing all of your manually installed packages:
Command Line
You can either use
sudo apt-get remove packagename
if you know the name of the package, or if you don't, search for it usingapt-cache search crazy-app
and then remove it using apt getYou can also use
dpkg --remove packagename
.This will also let you know if there are any unneeded packages left on your system, which were possibly installed as dependencies of your .deb package. Use
sudo apt-get autoremove
to get rid of them.The command to facilitate that is:
Also if you need to remove them forcefully
Every solution here assumes you know or can find the name of the package, but none provide how to remove a package if all you have is the deb. To that end, the below command will extract the package name from the deb and remove that package name.
NB: this does not confirm that the package being removed is the exact version described by the deb - be careful.
Open up Ubuntu Software Center (Applications -> Ubuntu Software Center) and search for the package you want to uninstall, and click on the Remove button:
Or from the command line:
Use
-r
withdpkg
.See this blogpost for more information.
If your want to remove the package and all configuration files related to it:
apt-get -y
Potentially Dangerous:Although it's true that- sans GUI- our choices are:
Where
dpkg
can be executed from a script without the equivalent of a " -y " switch,apt
requires this to avoid user input. The consequences are thatapt
could automatically resolve package dependencies and remove packages other than the target supplied to the command.apt
:Note when I remove iptables that lxd and ufw also removed. But what if I didn't want lxd removed? Well, it's gone now:
dpkg
:Note
dpkg
stops me from potentially altering the system in an unintended way if I were to use it in a scripted execution and refusing to remove both ufw and lxd:Conclusion:
So although it's true we like to ensure our scripts complete successfully and not exit in error, it might be desirable for a script to fail than complete by modifying the system outside of the target of the command. Such a use-case makes
dpkg -r
more desirable for scripted execution.Here is a user-friendly approach if you still got the .deb:
The installed package will be visible in both Synaptics and software center. In the former one, it will appear under local packages and in the latter one under other.
You can use the remove and force flags:
Alternatively, if you installed it through Ubuntu Package Manager, you can remove it with apt: