I love Synaptic's ability to search the repo for both installed and uninstalled packages, but I would like to use this same ability through the apt command line utility, so I can search for packages from a shell.

Is there a way to do this?

Thanks for any replies!


Yeah use aptitude!

If you want to search for something out of the installed packages try:

aptitude search '~i <other search terms>'

And you can negate the ~i so this would search packages that are not installed:

aptitude search '!~i <other search terms>'

aptitude can do a stupid amount of stuff and it's sad to see it being removed from future versions of Ubuntu (by default - you can still install it).

You can read more about aptitude's search terms here.


You could search for packages with apt-cache, searching for a pattern is like

apt-cache search <pattern>

If you only want to search in package names

apt-cache --names-only search <pattern>

Pattern are regular expressions, but be aware to protect them from shell expansion. If you use more than one pattern, they are and'ed together.

The output is the short description, if you want a long one, use the --full option.

Also, aptitude can do more specific searches, for example something like

aptitude search '?installed?not(?automatic)?priority("optional")?name("^s")'

but aptitude is not installed by default.

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.