Server Fault is a question and answer site for system and network administrators. 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

In Debian or one of its derivatives, how can I list all packages which I have installed from lenny-backports?

The closest I've come up with is:

aptitude search ~i~Alenny-backports

However, that lists all installed packages for which there exists a version in backports even if the currently installed version is not the one from backports. I'd like to list only the packages for which the currently installed version is from backports (or, not lenny, if that's easier).


share|improve this question
up vote 9 down vote accepted

Aptitude has a ?narrow search term for just this:

aptitude search '~S ~i ~Abackports'
aptitude search '?narrow(~i, ~Abackports)'
share|improve this answer
Excellent! Aptitude saves the day! Thanks – thomasrutter Feb 4 '10 at 23:29
So in other words, ~S is like an operator which means "the next two conditions have to apply to the exact same package and version". – thomasrutter Nov 23 '12 at 3:33
@thomas, ~S is like a simple and. It's every other aptitude operator (intersection, etc) that erases the version before computation. – Tobu Nov 23 '12 at 19:03

You can use the grep-status command (provided via the 'dctrl-tools' package):

grep-status -sPackage,Version -F Status 'installed' -a -F Version 'bp'

Example of output:

Package: libsvn-perl
Version: 1.6.4dfsg-1~bpo50+1

Package: subversion-tools
Version: 1.6.4dfsg-1~bpo50+1

Package: subversion
Version: 1.6.4dfsg-1~bpo50+1

Package: libapache2-svn
Version: 1.6.4dfsg-1~bpo50+1

Package: libsvn1
Version: 1.6.4dfsg-1~bpo50+1

Package: libdb4.7
Version: 4.7.25-7~bpo50+1

Package: trac
Version: 0.11.6-1~bpo50+1

Package: python-subversion
Version: 1.6.4dfsg-1~bpo50+1

If you need a more compact output (more suitable for further script-based processing), use simply

grep-status -nsPackage -F Status 'installed' -a -F Version 'bp'
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.