Ubuntu 11.10 – How to Completely Remove a Package

Finding Out Which Packages Were Installed

If you didn’t record which packages were installed, you can follow these steps to get that information:

These instructions are for Ubuntu 11.10, using the Unity interface and the Terminal application.

I expect the instructions to be similar for other environments, but no guarantee is made.

I had hoped to use the Log Viewer, but that application doesn’t work in Ubuntu 11.10 (at least not as of 02-Nov-2011). See here for bug report.

Opening the Installation History Log File

All installation and uninstallation operations that happen using apt-get or Ubuntu Software Center are stored in /var/log/apt/history.log. Examining the contents of this file allows us to determine which packages were installed.

1) Click on the Home Folder icon:

2) Click on File System:

3) Double-click on the var folder:

4) Double-click on the log folder:

5) Double-click on the apt folder:

6) Double-click on the history.log file – this should open it with gedit, the default text editor in Ubuntu 11.10:

A Quick Overview of the history.log File

The history.log file contains all the operations performed on your system using apt-get

Each block of operations (yellow) contains:

  • a Start-Date and End-Date (red) for the operation
  • the operation performed (blue)
  • additional information about the operation (green)

In our case, we are interested in the Install information.

Finding the Installation Data

7) Search for the package you installed. If it was the last package you installed, then it will be at the end of the file. The records are stored with the newest operations towards the end (bottom) of the file and the oldest at the beginning (top) of the file:

In the sample below, you can see I had installed lubuntu-desktop on 01-Nov-2011:

Start-Date: 2011-11-01 19:41:06
Commandline: apt-get install lubuntu-desktop
Install: libopenal1:i386 (1.13-2, automatic), libxfcegui4-4:i386 (4.8.1-5, automatic), chromium-browser-l10n:i386 (14.0.835.202~r103287-0ubuntu1, automatic), libobrender27:i386 (3.5.0-0ubuntu3, automatic), lxsession:i386 (, automatic), libts-0.0-0:i386 (1.0-9, automatic), libswscale2:i386 (0.7.2-1ubuntu1, automatic), chromium-codecs-ffmpeg:i386 (14.0.835.202~r103287-0ubuntu1, automatic), libavutil51:i386 (0.7.2-1ubuntu1, automatic), libhttp-daemon-perl:i386 (6.00-1, automatic), and, many, many others ...
End-Date: 2011-11-01 19:51:55

8) Cut and paste: the Install data into an editor. You can start a new document in gedit by clicking on the Create a new document icon:

9) Edit the data to be to remove all unnecessary text.

Looking at the data, we see that it has the following form: <package name>:i386 (something in parentheses),

Only the package name is of interest. The :i386 (something in parentheses), needs to be deleted.

So libopenal1:i386 (1.13-2, automatic) becomes libopenal1

If you have a lot of text to edit (as in this example), you might consider using a text editor that offers regular expression matching – like LibreOffice Writer – for search and replace.

Using LibreOffice Writer, you can use the following regular expression (I think it is complete, but it might miss the odd expression):

:i386 \([0-9\.\-\~\+a-zA-Z, ]\),

It seems the above macro doesn’t work with newer versions of LibreOffice (at least version 3.4.4 and up). Use this one instead:

:i386 \([0-9\.\-\+a-zA-Z, ]*\),?

Press Ctrl + Alt + F to launch the Search and Replace dialog in LibreOffice Writer.

  1. Click on the More Options button (it will change to Fewer Options.
  2. Click on the Regular expressions box.
  3. Enter the regular expression into the Search for field.
  4. Click on the Replace All button.
  5. Clean up the last entry. This regular expression misses the last one and requires manual clean up.

10) Add the following at the start of the edited package list: sudo apt-get remove –auto-remove

11) Cut and paste this package list with the apt-get command from step 10 into a Terminal to completely uninstall the package.


This should work perfectly if the package you are uninstalling is the LAST package you (or anybody else) installed on your system. In other words: No one has installed anything else – not even updates – since this package was installed!

If other packages have been installed, if updates have been installed, then there is a RISK that those packages or updates may have a dependency on one or more of the packages you are uninstalling.

If you uninstall a package that some other package depends on, then that package will no longer function correctly.

Examining all package dependencies is very complicated. Proceed at your own risk – backups are strongly recommended.


  • Mark D. says:

    I used apt-get autoremove to uninstall VirtualBox and it says it can’t locate file. I see it in my directories. But it doesn’t show up in my software center where I installed yesterday. Am I missing something. I don’t want to just remove the dir.

    • admin says:

      I haven’t run VirtualBox inside of Ubuntu (I use it to run Ubuntu inside of Windows), but … the command to remove it should be sudo apt-get remove –auto-remove virtualbox-qt.
      Entering sudo apt-get autoremove instructs the installer system to automatically remove unused packages from the computer.
      Hope this helps and thanks for your question.

  • Sul says:

    aptitude works great for removing those extra dependencies. Also, deborphan can help to find such packages.
    sudo aptitude purge package

    • admin says:

      You can definitely do sudo apt-get autoremove to clean up unused dependencies (which I mention in the article) – and this works fine, but it does not uninstall everything, neither does <>deborphan.
      For example, if you install the Xubuntu desktop, in addition to installing the desktop, it also installs Abiword (among other things). Even if you use the autoremove option of apt-get or you run deborphan, Abiword and all the the applications installed along with Xubuntu desktop do not get uninstalled. Since none of those applications are orphaned (because you can always install them yourself without installing the Xubuntu desktop), the only way to clean them up is to remove them one by one.
      The proper way for the uninstaller to work is to read the installation log to determine what needs to be uninstalled.
      My solution (page 3 of this article) shows the user how to do this manually.
      An even better uninstaller would tell you which applications (if extra applications had been installed) were being removed and give you the choice of keeping the applications you want. On the other hand, a good installer would tell you which extra applications are being installed (apt-get at the commandline does this, but the info is not displayed in the Ubuntu Software Center) and give you the choice of installing them or not.
      Thanks for your comment.

  • Marius says:

    Please, without command line nonsence… Is there any way to uninstall program with GUI?

    • admin says:

      There is no available GUI interface that allows you to completely remove a package and all the other packages installed with it in one step.
      However, you can use Ubuntu Software Center to completely remove all packages – you just have to do it one package at a time.
      (1) determine which packages were installed – this means looking at the history.log to find out which packages were installed.
      (2) enter the package names (one at a time) into the Ubuntu Software Center and click on Remove
      There is an updated (for Ubuntu 12.04)) version of this article here. It is shorter and better expains the problem and solution.
      So far, I have not found any software package (with or without at GUI) that completely uninstall what was installed – they all use sudo apt-get remove --auto-remove <package name> (or its equivalent). As my article explains, in many cases, this leaves behind unneeded and unused packages.
      There are a number of packages that claim to clean up your system, but what they do is run sudo apt-get autoremove which removes some left behind packages. Others also run sudo apt-get purge which cleans out the repository cache (these are the files that are downloaded when you install something), but it does not remove the installed packages.
      This is a serious problem and people should complain about it to Linux developers.