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

Is it possible to make aptitude show the available/installed version of a package in an output of aptitude search mypackage?

I know that I can show the version via aptitude show mypackage, but I want it it to appear also in the output of an aptitude search.

share|improve this question
up vote 3 down vote accepted

This might work for you. Put this in a script file named and make it executable.

for name in $(apt-cache search "$TERMS" | sed 's/ .*//'); do
    echo "$name "
    apt-cache show $name | grep -i -e "description-en" -e "version" | sed 's/^/    /'

A test. Put your search terms after the name when you run it.

$ ./  mesa-util
    Version: 8.0.1+git20110129+d8f7d6b-0ubuntu2
    Description-en: Miscellaneous Mesa GL utilities
    Version: 8.0.1+git20110129+d8f7d6b-0ubuntu2
    Description-en: Miscellaneous Mesa utilies (opengles, egl)
share|improve this answer
Thanks, but it is not yet exactly what I want: I want just add the version to the usual aptitude search output (where also a very short description of the package is included) – student Jul 6 '12 at 20:09
I edited it so that it prints out the package description too. – Sepero Jul 7 '12 at 6:12

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.