Search patterns

Searching for strings
Shorthand for search terms
Searches and versions
Explicit search targets
Search term reference

When you search for a package or set a display limit in aptitude, the string you enter is known as a search pattern. While the most basic usage of search patterns is to match packages by name, aptitude allows you to create much more complex searches. In addition to the visual interface, some command-line operations can use search patterns; see Command-line reference for details.

A search pattern consists of one or more conditions (sometimes known as terms); packages match the pattern if they match all of its terms. Terms generally start with a question mark (?), followed by the name of the match term, which describes the search that the term performs: for instance, the term ?name matches package names, while the term ?version matches package versions. Finally, any additional parameters to the search term are placed in parentheses (see the documentation of individual terms for details of what each term's parameters mean).

[注記]注記

Text with no leading ? also forms a search pattern: aptitude will treat each word (or quoted string) as the argument to a ?name pattern, which searches for a package whose name matches the text when the text is interpreted as a regular expression.

[警告]警告

The behavior of aptitude when given a search pattern without a leading ? (or ~) is provided as a convenience for interactive use and will change in future releases; scripts that invoke aptitude should explicitly name the search strategy they want to use. That is, scripts should search for ?name(coq) rather than coq).