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.
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 tilde character (“~”), followed by a character identifying the type of term, and then any additional text required by the term.
Most textual searches (for package names, descriptions, etc) are performed using case-insensitive regular expressions. This means that you must backslash-escape regular expression metacharacters [10] in searches (for instance, to find “g++”, you should use the pattern “g\+\+”).
The following types of terms are available:
Matches packages whose names match the regular expression name. This is the “default” search mode and is used for patterns that don't start with ~.
![]() | Note |
---|---|
To match packages whose names contain several different substrings, use the ~n matcher (described below); for instance, “~napti~ntude”. |
Matches packages which do not match the term term. For instance, “!~b” selects packages that are not “broken”.
![]() | Note |
---|---|
To include a “!” in a regular expression, it must be “escaped” to prevent aptitude from considering it part of a NOT term: “~!”. |
Matches packages that match either term1 or term2.
![]() | Note |
---|---|
To use the character “|” in a regular expression, it must be “escaped” to prevent aptitude from creating an OR term from it: “~|”. |
Matches term; this is useful to explicitly select the grouping of complex expressions. For instance, “~D(perl|python)” matches any package that depends on a package whose name contains either perl or python.
Matches packages which are available from an archive that matches the regular expression archive. For instance, “~Atesting” matches any package available from the testing archive.
Matches packages on which the given action is going to be performed. action can be “install”, “upgrade”, “remove”, “purge”, or “hold”.
Matches packages which have an unfulfilled (“broken”) dependency of the given type. type can be “depends”, “predepends”, “recommends”, “suggests”, “conflicts”, or “replaces”.
Matches packages that are “broken”: they have an unfulfilled dependency, predependency, or conflict.
Matches packages which conflict with a package matching the given term. For instance, “~C~mdburrows@debian.org” matches any package which conflicts with a package I maintain.
Matches packages which have been removed, but whose configuration files remain on the system (ie, they were removed but not purged).
type may be either “provides” or one of the dependency types given in the documentation of ~B. If type is not present, it defaults to depends.
If type is “provides”, matches packages that provide a package matching term (the equivalent of ~P). Otherwise, matches packages which declare a dependency of type type upon a package which matches term.
Matches packages whose description matches the regular expression description.
Matches Essential packages.
This term does not match any package (“F” stands for “false”). [11]
Matches packages which are not installed, or which were automatically installed and are not depended upon by any installed package.
Matches packages which are currently installed.
Matches packages which were automatically installed.
Matches packages whose Maintainer field matches the regular expression maintainer. For instance, “~mjoeyh” will find all packages maintained by Joey Hess.
Matches packages which are “new”.
Matches packages whose name matches the regular expression name. For instance, most of the packages that match “~n^lib” are libraries of one sort or another.
Matches packages whose origin matches the regular expression origin. For instance, “!~Odebian” will find any unofficial packages on your system (packages not from the Debian archive).
Matches packages which provide a package that matches the name. For instance, “~Pmail-transport-agent” will match all the packages that provide “mail-transport-agent”.
Matches packages whose priority is priority; priority must be extra, important, optional, required, or standard. For instance, “~prequired” matches packages whose priority is “required”.
type may be either “provides” or one of the dependency types given in the documentation of ~B. If type is not present, it defaults to depends.
If type is “provides”, matches packages whose name is provided by a package matching term. Otherwise, matches packages which a package matching term declares a dependency of type type upon.
Matches packages whose section matches the regular expression section.
This term matches any package. For instance, “~i~P~T” matches installed packages which are provided by any package.
This term matches any installed package which can be upgraded.
Matches any package whose version matches the regular expression version. For instance, “~Vdebian” matches packages whose version contains “debian”.
![]() | Note |
---|---|
If several versions of the package are available, which version is considered depends on context; however, it is usually either the current version or the candidate version. |
Matches any package which is purely virtual: that is, its name is provided by a package or mentioned in a dependency, but no package of that name exists. For instance, “~v!~P~T” matches packages which are virtual and are not provided by any package: ie, packages which are depended upon but do not exist.
[10] Regular expression metacharacters include: “+”, “-”, “.”, “(”, “)”, “|”, “[”, “]”, “^”, “$”, and “?”. Note that some of these are also aptitude metacharacters, so if you want to type (for instance) a literal “|”, it must be double-escaped: “\~|”.
[11] This is provided largely for symmetry with ~T.