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.

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

1 Answer 1

up vote 3 down vote accepted

This might work for you. Put this in a script file named apt-version.sh 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.

$ ./apt-version.sh  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.