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).


2 Answers 2


Aptitude has a ?narrow search term for just this:

aptitude search '~S ~i ~Abackports'
aptitude search '?narrow(~i, ~Abackports)'
  • 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". Nov 23, 2012 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, 2012 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'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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