191

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?

165

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"

alt text

Along with this, there are a few other methods:

Synaptic:

  • Go to System → Administration → Synaptic Package Manager
  • Click the Status button and select "Installed (local or obsolete)"
  • Right click a package and select "mark for removal".
  • Click the Apply button.

    This will have the benefit of listing all of your manually installed packages:

alt text

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 using apt-cache search crazy-app and then remove it using apt get

  • You can also use dpkg --remove packagename.

@GorgeEdison it's a security risk! :P @EveryoneElse, never mind I'm kidding :)

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.

| improve this answer | |
  • aerofs-installer-0 (aerofs.com) did not appear in U.S.C., only in the command line and in synaptic. Any idea why? – nutty about natty Oct 20 '13 at 5:51
  • You can use "sudo apt purge package-name" to uninstall the package and the package's configuration as well. – kas 14 hours ago
98

The command to facilitate that is:

sudo dpkg -r package_name

Also if you need to remove them forcefully

sudo dpkg -r --force-all pkg_name
| improve this answer | |
  • 40
    or dpkg --purge package_name to erase configuration files as well. – Tom Jan 19 '11 at 1:20
9

Open up Ubuntu Software Center (Applications -> Ubuntu Software Center) and search for the package you want to uninstall, and click on the Remove button:

alt text

Or from the command line:

sudo apt-get remove <package-name>
| improve this answer | |
5

Use -r with dpkg.

See this blogpost for more information.

| improve this answer | |
5

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.

dpkg -r $(dpkg -f your-file-here.deb Package)

NB: this does not confirm that the package being removed is the exact version described by the deb - be careful.

| improve this answer | |
4

If your want to remove the package and all configuration files related to it:

sudo aptitude purge packagename
| improve this answer | |
2

Although it's true that- sans GUI- our choices are:

  • apt-get remove (or "purge") packageName
  • dpkg -r packageName

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 that apt could automatically resolve package dependencies and remove packages other than the target supplied to the command.

apt:

Note when I remove iptables (I use firewalld) that lxd and ufw (a front-end for iptables) is also removed. But what if I didn't want lxd removed? Well, it's gone now:

apt-get -y purge iptables
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  iptables* lxd* ubuntu-standard* ufw*
0 upgraded, 0 newly installed, 4 to remove and 54 not upgraded.
After this operation, 23.2 MB disk space will be freed.
(Reading database ... 90906 files and directories currently installed.)
Removing ubuntu-standard (1.417.3) ...
Removing ufw (0.36-0ubuntu0.18.04.1) ...
Skip stopping firewall: ufw (not enabled)
Removing lxd (3.0.3-0ubuntu1~18.04.1) ...
Removing lxd dnsmasq configuration
Removing iptables (1.6.1-2ubuntu2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
(Reading database ... 90627 files and directories currently installed.)
Purging configuration files for ufw (0.36-0ubuntu0.18.04.1) ...
Purging configuration files for lxd (3.0.3-0ubuntu1~18.04.1) ...
Processing triggers for systemd (237-3ubuntu10.38) ...
Processing triggers for rsyslog (8.32.0-1ubuntu4) ...
Processing triggers for ureadahead (0.100.0-21) ...

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:

dpkg -r iptables
dpkg: dependency problems prevent removal of iptables:
 lxd depends on iptables.
 ufw depends on iptables.

dpkg: error processing package iptables (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 iptables

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 might make dpkg -r more desirable for scripted execution.

| improve this answer | |
1

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.

| improve this answer | |
1

You can use the remove and force flags:

$ sudo dpkg -r --force-all pkg_name 

Alternatively, if you installed it through Ubuntu Package Manager, you can remove it with apt:

$ sudo apt remove --purge pgk_name
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.