Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to install a package (DigiKam), but it has a lot of dependencies. If I decide I no longer need this software and uninstall it, will the now unnessary dependencies be removed?

If not, how can I do it manually?

share|improve this question
up vote 57 down vote accepted

You can use the command apt-get autoremove. It will remove packages that are installed as automatic dependencies, but are not depended anymore.

apt-get has a flag --auto-remove that can be used to automatically remove the automatically installed packages when removing a manually installed package:

apt-get remove --auto-remove packagename

Certain other tools are also capable of doing this, for example aptitude will automatically suggest that you remove the packages that have been orphaned.

The automatically installed packages tracking is built in to apt so the tracking should work no matter which tool you use to install the packages.

share|improve this answer
Beat me to it. :) – jumpnett Jul 29 '10 at 20:57
By just mere seconds =) – Ressu Jul 29 '10 at 21:01
So, the answer would be that it is NOT done automatically on removing the "parent" package, right ? – jfoucher Jul 29 '10 at 21:12
It depends on the method you use to remove the parent package. For example aptitude suggests that those packages are removed when you uninstall the parent package. Not all tools do this though. – Ressu Jul 30 '10 at 6:08
You can remove a package and all of its now-no-longer-needed dependencies in one step with sudo apt-get remove --auto-remove package. – Marius Gedminas Jul 30 '10 at 11:58
aptitude purge digikam
aptitude purge $(deborphan)

deborphan lists packages which are not used or do not depend. So you can safely uninstall them. I tend to use purge as option of aptitude because it removes also config files and other stuff.

share|improve this answer
When using deborphan it is often necessary to run it a few times in a row, or at least it was in my experience with it. It seemed to continue to find new stuff. – mfisch Jul 30 '10 at 2:58
Yep, that's right. Someone wrote an improvement to deborphan. But that never made its way into Debian. The algorithm was better and you had it to run only once. Maybe I'd ask the author if he wants to add it again to Debian/Ubuntu repos. – qbi Jul 30 '10 at 12:07
Maybe I cannot use it, but deborphan usually wants to remove many applications that I actually use, as well as some important system packages. – Rafał Cieślak Aug 25 '11 at 18:38
aptitude purge <pkgname> is very useful for completely obliterating packages that have had a failed/partially successful uninstallation. Their status may be listed by dpkg -L <pkgname> as deinstall but using aptitude will remove them completely from aptitude's database, and lingering files not removed by the failed installation seemed to be removed too. – KomodoDave Mar 12 '13 at 16:50

I use ubuntu tweak, it has a very effecient app cleaning utility that has never removed more then it should.

share|improve this answer

The Computer Janitor, in the system menu can do this too.

share|improve this answer
+1 for actually using the computer janitor! – jfoucher Aug 5 '10 at 6:13
sudo apt-get remove --auto-remove 

Only run this.

Install BleachBit from Software Center. When you clean ur system using it, BleachBit will automatically run this command to clean the apt cache.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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