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.

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!

share|improve this question

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

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.