Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to figure out a way to get a list of the packages that are no longer available in the repositories that I have enabled. This workstation has been through quite a few versions of Ubuntu and has had many 3rd party repositories added and removed. I'd like to get a list of software that I have from these removed repositories, so I can clean it up or add back the appropriate repositories.

share|improve this question

migrated from serverfault.com Jan 24 '12 at 19:43

This question came from our site for system and network administrators.

2 Answers 2

up vote 8 down vote accepted
aptitude search '~o'

Aptitude has some very powerful searching available. Unfortunately the syntax is a bit unwieldy and you have to dig past the manpage to find the documentation, but its worth it.

apt-show-versions can also be helpful:

apt-show-versions | grep 'No available version'
share|improve this answer
see a nice article about obsolete packages here: raphaelhertzog.com/2011/02/07/… –  tictacbum Mar 8 '14 at 11:02

There may be a cleaner way, but off the top of my head you can do

dpkg -l | cut -f 3 -d ' ' > installed
xargs -n 1 --replace=X apt-cache search ^X$ < installed | cut -f 1 -d ' ' > available
diff installed available

Cleanup the first few lines of the installed file: it will have headers.

Bonus if anyone can fix my syntax highlighting...

share|improve this answer
if you are going to use the output of dpkg -l to get a list of installed packages, you should limit the results to lines with 'i' in the second column, as dpkg will also list packages which are not installed (perhaps removed but not purged). as an example, altering your first command to be dpkg -l | grep '^.[^i]' | cut -f 3 -d ' ' it would return a list of packages, which are NOT installed. (but once were) –  stew Jan 24 '12 at 19:46
also, apt-cache search someinstalledpackage will return something even if the package isn't available from a repo, so I don't believe this will work at all. –  stew Jan 24 '12 at 19:54
@stew I'll leave this up here to see if anybody reaches conclusions, but your answer is definitely far better. +1 to you. –  Jeff Ferland Jan 24 '12 at 19:59

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.