Removing packages + dependencies from Synaptic in Ubuntu

So, a complaint that has come up a number of times over the years is the fact that you can open up Synaptic package manager, browse through the history, find a package you installed and all of the dependencies that came with it, and… nothing.  It’s just a text log, you can’t select or un-install those packages.

Now, aptitude auto-remove almost solves this problem, but there are still cases where for one reason or another, auto-remove is fudged up or something, or you just want to uninstall a few packages.

For these situations, I offer the following simple, terminal-based hack solution:

  1. Open Synaptic package manager, go to File>History, and browse around until you find the packages you want.
  2. Select the packages and copy them (or just select them and use the magic middle click buffer)
  3. Open up a text file, say foobar.log, and paste the list of packages into this file
  4. Run the following command in a terminal:
sudo aptitude remove `cat foobar.log | awk '{gsub(/\(.*\)/,"");print}' | xargs echo`

This will tell aptitude to remove all of the entries that you pasted into foobar.log.  Awesome!

This entry was posted in Linux and tagged .

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>