196

Seeing there are various ways to install on Ubuntu. What are the various ways to uninstall items?

Which ways always work? How can I be sure something was uninstalled?

10 Answers 10

225

If the application has been installed via the package manager, all you have to do is run

sudo apt-get remove <application_name>

That should always work. If the terminal isn't what stirs your tea, you could open System → Administration → Synaptic Package Manager, search for the package you want to remove, click on the checkbox next to it and select "mark for removal". Once you click "Apply", the package should be removed. There's of course also the Ubuntu Software Center. It's pretty much the same thing as Synaptic. Just search for the application name and click the "Remove" button.

Sometimes applications can be split up into multiple packages (for example, many games have a separate package for their music). To make sure that you uninstall all related packages AND configuration files, you can type

sudo apt-get purge <package-name>

or -in Synaptic- "mark for complete removal" instead of just "mark for removal".

As for applications that have been manually compiled and installed, there's not always a single way to remove them. The best thing to do is consult the README/INSTALL file that accompanied the source package - if one exists.

  • 1
    Do you need to be in a specific directory? For some reason it is unable to locate my package. – Goldname Jul 6 '16 at 6:02
  • 2
    Ubuntu 16.04 doesn't have a System -> Administration, or Synaptic installed by default. – Dan Dascalescu Sep 6 '16 at 4:15
  • This works too: sudo apt remove <application_name> (Ubuntu 18.04.1 LTS) – Yuci Oct 18 '18 at 8:51
61
  • The software centre: find the package, click remove

    enter image description here

  • Synaptic Install synaptic: the same

    enter image description here


  • apt-get:

    sudo apt-get remove <package> && sudo apt-get autoremove
    
  • aptitude:

    sudo aptitude remove <package>
    

It's important to note that when you install things, they often depend on other packages. When you fire off apt-get remove <package> it doesn't remove the automatically-installed applications by default. This is often safer (if you're temporarily removing something like ubuntu-desktop) but this can mean you end up with a load of cruft.

aptitude will automatically remove things (as well as having a nice interactive command line interface)

You can also search for cruft in synaptic using the "local or obsolete" filter under the status section.

  • 1
    the apt-get-version can be shorter & easier: sudo apt-get autoremove <package> – DJCrashdummy Jul 17 '17 at 21:40
  • +1 for autoremove it looks like that also removes dependencies that were installed along with the original program? nice to keep from cluttering things up. – anon58192932 Nov 28 '17 at 23:09
11

Here's a rundown of the possible ways:

If the package has been installed via a package manager, you can remove it with one of the tools provided with this purpose:

  • dpkg --remove: the most basic command-line tool. Avoid.
  • apt-get remove or aptitude remove: these are the standard command-line tools. Aptitude is slightly preferred: it's a bit more sophisticated. E.g., it can keep a log file of all package operations.
  • synaptic: GUI tool accessible through the GUI menu under "System/Administration". Supports all features, a very nice program generally.
  • software center: even nicer GUI than synaptic. This is a better, updated version of the old "Add/Remove Programs"

All these get the job done. You can start with the most user-friendly (Software Center) and continue to aptitude, if you need certain features or install or remove programs very frequently.

Note that these operations remove the bulk of the program while sometimes leaving "configuration files" in locations such aus /etc/apache2. Most software doesn't have configuration files there; some server software ("daemons") do. In all but a few cases, keeping these configuration files will do no harm. If you want to remove everything, including configuration files, then you can use the "purge" operation. For aptitude, the command line is "aptitude purge." (Tommy's explication above of "purge" is not accurate. The "remove" operation, just like "purge", deletes all dependencies that were pulled in with the original program.)

If the program tells you the package has been removed, you can be sure that the files are gone. Sometimes packages installed as a matter of dependency are not removed immediately. They will be eventually deleted, at a subsequent run.

As to software installed from other channels (typically compiled from source), you're mostly forced to remove the files installed manually. They are often located somewhere in /usr/local. Some software provides shortcuts such as "make uninstall". Don't count on it, though. More often than not, the cleanest solution is to use the version provided through Ubuntu's repositories, which can be uninstalled cleanly.

5

GUI Methods

Ubuntu Software

The easiest way is to use Ubuntu Software (or Ubuntu Software Center in releases older than Ubuntu 16.04LTS). Open Ubuntu Software, click the Installed tab, select the app you wish to uninstall, and hit the Remove button.

Uninstall Apps using Software

Uninstall Apps using Software Center

Unity Dash

Ubuntu 12.10 brought Unity 6, which introduced the Preview feature. So, from Ubuntu 12.10 onwards, you can just right click on (almost) any app icon on Unity Dash and click uninstall.

Unity Dash Uninstall Apps from Unity Dash

Synaptic

Synaptic is an advanced package management tool and gives you more control than other GUI methods like Ubuntu Software, Unity Dash, etc. It was infact the default app manager before Ubuntu 10.04. To install Synaptic, click here:
Install via Ubuntu Software

Or run this in Terminal:

sudo apt install synaptic

To uninstall apps through Synaptic, mark the packages to be removed and then hit the Apply button:

Uninstall Apps using Synaptic


Command Line Methods

These are for the command line fans out there. They're pretty basic, but offers more advanced control and are lightweight.

apt

apt (newer and simplified apt-get) is the most commonly used command line tool for package management. Use the following command to uninstall any app:

sudo apt remove <app_name>

Remember to replace <app_name> with the package name of app you wish to uninstall.

aptitude

aptitude isn't exactly a command line tool, as it has an interactive ncurses based GUI. However, the following command can be used:

sudo aptitude remove <app_name>

snap

Ubuntu 16.04LTS and newer has support for snap packages, but can be installed on Ubuntu 14.04LTS too via updates. To uninstall a snap app, try:

snap remove <app_name>

and if that doesn't work:

sudo snap remove <app_name>

Note that all the above methods will work only on apps installed normally, i.e through package management (Ubuntu Software, Synaptic, apt, snap, etc.) and not on softwares manually installed using some root scripts or by directly copying to home. Though the above methods look very different, all of them use the same APT or Snappy package manager backend underneath. There are many more methods for installing/uninstalling apps, but the ones involving APT or Snappy are the recommended and most popular methods.

3

To find the package you want to remove, use

dpkg --list

Copy the package name and then use command

sudo apt-get purge <paste copied package name>

Then enter your password.

2
sudo apt-get purge <package_name>

sudo aptitude purge <package_name>

When you purge, aptitude removes the package as well as the dependencies that were installed along with it.

2

What are the various ways to uninstall items or packages?

command-line tools,

  • aptitude

    By default aptitude was not installed on your Ubuntu system.So run this command(sudo apt-get install aptitude) to install it.

    To uninstall a package through aptitude,run (sudo aptitude purge package)

  • apt-get

    sudo apt-get purge package
    
  • dpkg

    sudo dpkg -P package
    

GUI tools,

  • Software-center

  • Synaptic package manager

Which ways always work?

All the above mentioned ways will work for uninstalling a package.

How can I be sure something was uninstalled?

You can check if a package was successfully uninstalled or not by running apt-cache policy package command,

Example:

avi@avi-Lenovo-IdeaPad-Z500:~$ sudo apt-cache policy vlc
vlc:
  Installed: 2.0.8+git20131210+r49167+13+8~ubuntu13.10.1
  Candidate: 2.0.8+git20131210+r49167+13+8~ubuntu13.10.1
  Version table:
 *** 2.0.8+git20131210+r49167+13+8~ubuntu13.10.1 0
        500 http://ppa.launchpad.net/videolan/stable-daily/ubuntu/ saucy/main amd64 Packages
        100 /var/lib/dpkg/status
     2.0.8-1 0
        500 http://mirror.sov.uk.goscomb.net/ubuntu/ saucy/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages

In the above,while running apt-cache policy on vlc pacakage shows the Installed field as,

Installed: 2.0.8+git20131210+r49167+13+8~ubuntu13.10.1
   
avi@avi-Lenovo-IdeaPad-Z500:~$ sudo apt-cache policy chromium-browser
chromium-browser:
  Installed: (none)
  Candidate: 32.0.1700.102-0ubuntu0.13.10.1~20140128.970.1
  Version table:
     32.0.1700.102-0ubuntu0.13.10.1~20140128.970.1 0
        500 http://mirror.sov.uk.goscomb.net/ubuntu/ saucy-updates/universe amd64 Packages
        500 http://mirror.sov.uk.goscomb.net/ubuntu/ saucy-security/universe amd64 Packages
     29.0.1547.65-0ubuntu2 0
        500 http://mirror.sov.uk.goscomb.net/ubuntu/ saucy/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages

But on running apt-cache policy chromium-browser,the installed field shows none.Which means the package was not installed.

Installed: (none)
1

In certain cases, there are some dependencies that are left even after issuing the commands which the other answers have stated. Like, in this scenario, the OP had installed CCSM (Compiz Configuration Setting Manager) but removing only CCSM does not remove the entire dependencies that were required while installing it and leaves a number of packages which are no longer used like compiz-core, compiz-gnome, compiz-plugins, compiz-plugins-default, libcompizconfig0, python-compizconfig etc.

Using sudo apt-get autoremove or sudo aptitude autoremove removes all such unused dependencies in all such cases.

EDIT: Mine was an extension to an existing answer by Oli.

0

I have tried this and it works fine on terminal!!

sudo apt autoremove <Package name>

For Package name you can enter the initial letter of package or software, etc and press Tab key.

0

For custom installed software (e.g. ./install.sh), you can look for an ./uninstall.sh. Or you can try running ./install.sh again, it may give you an uninstall option.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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