312

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?

12 Answers 12

237

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.

4
  • 1
    aerofs-installer-0 (aerofs.com) did not appear in U.S.C., only in the command line and in synaptic. Any idea why? Oct 20, 2013 at 5:51
  • 1
    You can use "sudo apt purge package-name" to uninstall the package and the package's configuration as well.
    – kas
    Jun 1, 2020 at 2:20
  • 3
    +1 for pointing to synaptic - software center didn't show the app (Microsoft teams, maye because there is also another version from ubuntu??)
    – Breaker222
    Jun 17, 2020 at 20:50
  • dpkg --remove webex helped me remove Cisco Webex. Thanks! Dec 20, 2021 at 8:31
166

To remove package_name, use dpkg with the -r (or --remove) flag:

sudo dpkg -r package_name

If you have to force-remove it, add --force-all:

sudo dpkg -r --force-all pkg_name

Use -P (or --purge) instead of -r if you want to remove the configuration files as well.

1
  • 54
    or dpkg --purge package_name to erase configuration files as well.
    – Tom
    Jan 19, 2011 at 1:20
81

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.

3
  • 5
    An only correct answer. For uninstalling all *.deb files in current directory command could be something like: for PPP in *.deb ; do sudo dpkg -r $(dpkg -f "$PPP" Package) ; done
    – dess
    May 1, 2021 at 17:30
  • 1
    This should be the correct answer, especially with dess loop script.
    – Dave
    Aug 15, 2022 at 18:36
  • @YodaDaCoda This was very helpful. Thanks a lot.
    – Ishan
    Nov 15, 2023 at 7:44
10

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>
6

Use -r with dpkg.

See this blogpost for more information.

5

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

sudo aptitude purge packagename
5

apt-get -y Potentially Dangerous:

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 that lxd and ufw 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 makes dpkg -r more desirable for scripted execution.

4

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
4

Here is a user-friendly approach if you still got the .deb:

  1. Double-click on .deb
  2. Ubuntu Software window will open
  3. Press the "Remove" button
2

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.

1

obviously, You can use the remove and force flags:

sudo dpkg -r --force-all    'some_bad_package'

but in very many cases that won't help at all. Neither will it help in case of dpkg breakage to try any of the GUI tools like synaptic or even worse ones, since they all depend on dpkg . This is because dpkg is very opinionated on those often-occurring errors, leaving many users marooned. Here is an example where a .deb was sideloaded and Ubuntu does not offer a GUI way nor CLI way to solve the problem:

LANG=en sudo dpkg --purge 'brmfc7440nlpr:i386'

dpkg: error processing package brmfc7440nlpr:i386 (--purge): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: brmfc7440nlpr:i386

And yes, the lead to "reinstall it before attempting..." is of course utterly futile and redundant, since it just runs into the same error with another flavour.

And yes, adding " --force-all " just is as futile as without, obviously.

This already will lead many users to reinstall Ubuntu in hopes of betterment, taking many, many hours of extra work. The package from the real-world example above is a laserprinter (lpr) driver for a brother MFC model 7440N.

0

First, check the application that you want to uninstall with below command.

find /usr/share/applications -maxdepth 1 -type f -exec basename {} .desktop \; | sort

Once you find the application name in the above list, run the below command

sudo apt remove your_application_name

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .