Apt - Search Syntax
Florian Diesch
diesch at spamfence.net
Sat Aug 12 19:21:35 UTC 2006
email.listen at googlemail.com wrote:
> Hi Gregory
> Am Sat, 12. August 2006 04:47 schrieb Gregory PiƱero:
>> What is the command line equivalent of Synaptic Package Manager's Search?
>>
>> For example I want to see if there is a matplotlib package and how to
>> spell it (proper cases and such)
>>
>> Bonus points for telling me how to find this information for myself in
>> the future. I tried the following with no luck:
>> $ apropos search packages
>> $ man apt-get
>> Google search
> You can do this with apt-cache and using regular expressions.
> E.G. for your example matplot:
>
> apt-cache search mat*
That's not what you want: The * may be expanded by the shell so you need
to protect it: apt-cache search 'mat*'. But as it is a regex, not a
shell glob, it doesn't mean "'mat' followed by arbitrary characters" but
"'ma' followed by zero or more 't's".
What you really want is
apt-cache search 'mat.*'
> As you can see I've used (*) but also more complex regular expressions will do
> the job:
>
> apt-cache search [a-z]plot
>
> Both examples produce a lot of output so it needs some filtering.
> You can do this with grep, just pipe the output of apt-cache to grep:
>
>
> apt-cache search [a-z]plot|grep mat
Use
apt-cache search --names-only mat plot
to search for packages where the name contains 'mat' and 'plot'
Florian
--
<http://www.florian-diesch.de/>
More information about the ubuntu-users
mailing list