Apt - Search Syntax

email.listen at googlemail.com email.listen at googlemail.com
Sat Aug 12 04:41:21 UTC 2006


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*

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

fv - a tool for viewing and editing FITS format files
kmatplot - A Gnuplot-like tool for plotting data sets in 2D or 3D
amanda-client - Advanced Maryland Automatic Network Disk Archiver (Client)
amanda-server - Advanced Maryland Automatic Network Disk Archiver (Server)
calc - An advanced calculator and mathematical tool for Emacs.
kmplot - mathematical function plotter for KDE
python-matplotlib - python based plotting system in a style similar to Matlab
python-matplotlib-data - python based plotting system (data package)
python-matplotlib-doc - python based plotting system (documentation package)
python2.4-matplotlib - python based plotting system (Python 2.4 version)

And voila, there it is, python-matplotlib 


Another way would be using apt-file to search for a file if you don't know the 
packet name which holds this file. If you use apt-file for the first time you 
have to do an:
 apt-file update
to make it aware of all packages/files

Now search for a filename and apt-file will give you it's packet name:
 apt-file search matplot

This will give a lot of output again so it's a good idea to pipe it to less

 apt-file search matplot|less

Scroll up and down the list using <Pg-up> and <Pg-down> or <Up> and <Down> 
arrow-keys. (If you have a look to the manpage of less you will see that it 
is one of the biggest manpages next to the bash manpage a GNU/Linux system 
has :)
You will see that there is also a matplot command in the packet r-base-core:

 apt-cache search r-base
 r-base - GNU R statistical computing language and environment



regards,
thomas




More information about the ubuntu-users mailing list