With the large and ever-growing amount of software in Debian, there emerges a paradox: Debian usually has a tool for most tasks, but that tool can be very difficult to find among the myriad other packages. The lack of appropriate ways to search for (and to find) the right tool has long been a problem. Fortunately, this problem has almost entirely been solved.
最琐碎的搜索可能是找到正确的软件包名称。若 apt show 软件包名称
返回结果,表示该软件包存在。不幸的是,必须知道或猜对软件包名称,却几乎是不可能的.
搜索纯文本的软件包名称,虽然有限制但成功率较高。还可以搜索软件包说明的内容:除了搜索软件包名称、关键词之外,还可搜索其说明。
apt-cache
与
axi-cache
是此类搜索工具 (见
其他 axi-cache
);例如,
apt-cache search video
将找出名称或说明内有键词 “video” 的软件包。
更复杂的搜索,需要更有力的工具,如 aptitude
是其中之一。aptitude
可搜索软件包元数据字段的内容。例如,以下的范例搜索含有 kino
字样的软件包名称,其说明包括 video
与维护者名字为 paul
:
$ aptitude search kino~dvideo~mpaul
p kino - Non-linear editor for Digital Video data
$ aptitude show kino
Package: kino
Version: 1.3.4+dfsg0-1.1
State: not installed
Priority: optional
Section: video
Maintainer: Paul Brossier <[email protected]>
Architecture: amd64
Uncompressed Size: 8,316 k
Depends: libasound2 (>= 1.0.16), libavc1394-0 (>= 0.5.3), libavcodec58 (>= 7:4.2),
libavformat58 (>= 7:4.2), libavutil56 (>= 7:4.0), libc6 (>= 2.29), libdv4
(>= 1.0.0), libgcc-s1 (>= 3.0), libgdk-pixbuf-2.0-0 (>= 2.22.0),
libglade2-0 (>= 1:2.6.4-2~), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>=
2.24.0), libiec61883-0 (>= 1.2.0), libpango-1.0-0 (>= 1.14.0),
libpangoft2-1.0-0 (>= 1.14.0), libquicktime2 (>= 2:1.2.2), libraw1394-11
(>= 2.1.2), libsamplerate0 (>= 0.1.7), libstdc++6 (>= 9), libswscale5 (>=
7:4.0), libx11-6, libxext6, libxml2 (>= 2.7.4), libxv1
Recommends: ffmpeg, curl
Suggests: udev | hotplug, vorbis-tools, sox, mjpegtools, lame, ffmpeg2theora
Conflicts: kino-dvtitler, kino-timfx, kinoplus, kino-dvtitler:i386,
kino-timfx:i386, kinoplus:i386, kino:i386
Replaces: kino-dvtitler, kino-timfx, kinoplus, kino-dvtitler:i386,
kino-timfx:i386, kinoplus:i386
Provides: kino-dvtitler, kino-timfx, kinoplus
Description: Non-linear editor for Digital Video data
Kino allows you to record, create, edit, and play movies recorded with DV
camcorders. This program uses many keyboard commands for fast navigating and
editing inside the movie.
The kino-timfx, kino-dvtitler and kinoplus sets of plugins, formerly distributed
as separate packages, are now provided with Kino.
Homepage: http://www.kinodv.org/
Tags: field::arts, hardware::camera, implemented-in::c, implemented-in::c++,
interface::graphical, interface::x11, role::program, scope::application,
suite::gnome, uitoolkit::gtk, use::editing, use::learning,
works-with::video, x11::application
此搜索只找到一个软件包,kino,满足全部三个条件。
Even these multi-criteria searches are rather unwieldy, which explains why they are not used as much as they could. A new tagging system has therefore been developed, and it provides a new approach to searching. Packages are given tags that provide a thematic classification along several strands, known as a “facet-based classification”. In the case of kino above, the package's tags indicate that Kino is a Gnome-based software that works on video data and whose main purpose is editing.
Browsing this classification can help you to search for a package which corresponds to known needs; even if it returns a (moderate) number of hits, the rest of the search can be done manually. To do that, you can use the
~G
search pattern in
aptitude
, but it is probably easier to simply navigate the site where tags are managed or use the
debtags
command:
以 works-with::video
及 use::editing
标签可找出若干软件包,包括 kino 与 pitivi 影像编辑器。愈来愈多人使用这种分类系统,在此基础上,软件包管理者创建更有效的接口。
总的来说,最好的工具取决于搜索时你所期望达到的复杂程度:
apt-cache
只能通过软件包名称和描述信息来进行搜索,对于搜索符合少量关键词的特定软件包十分方便;
当搜索条件包括软件包之间的关系或者像维护者名称的其它元数据时,synaptic
将更加有用;
当需要基于标签来搜索时,packagesearch
是一个很好用的工具,可以根据若干条件(包括软件包中包含的文件名)进行软件包搜索的图形化专用工具。命令行下则使用 axi-cache
。
最后,当搜索涉及有逻辑操作的复杂的表达式时,首选工具为 aptitude
的搜索语法,尽管有点晦涩难用但功能相当强大,它有命令行和交互两种模式。