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 terms; see Kommandoradsreferens för aptitude 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 tilde character (“~”), followed by a character identifying the type of term, and then any additional text required by the term.
By default, patterns are checked against all versions of the package.
However, some patterns will restrict which versions are tested. For
instance, the ~D
pattern
takes another pattern as an argument, and matches any package that depends
on another package matching that pattern. In this case, only package
versions that satisfy the dependency will be tested against. The versions
that are used to test for a match will only change in match terms that have
a subterm (like ~D
).
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 [11] in searches (for instance, to find “g++”, you should use the pattern “g\+\+”).
Normally, “whitespace” -- that is, space characters, tabs, and
so on -- separates terms but is otherwise ignored by aptitude. To include
whitespace (or other special characters) in a term, you can either place a
tilde in front of it (as in Debian~ Project
) or place
quotation marks around it (as in "Debian Project"
or even
Debian" "Project
). Inside a quoted string, the backslash
character (“\”) can be used to cancel the special meaning of
the quotation mark: for instance, ~d"\"email"
will match
any package whose description contains a quotation mark followed immediately
by email
. [12]
The following types of terms are available:
namn
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 ~
.
Notera | |
---|---|
To match packages whose names contain several different substrings, use the
|
!term
Matches packages which do not match the term
term
. For instance,
“!~b
” selects packages that are not
“broken”.
Notera | |
---|---|
To include a “!” in a regular expression, it must be
“escaped” to prevent aptitude from considering it part of a
NOT term: “ |
term1
|
term2
Matches packages that match either term1
or
term2
.
Notera | |
---|---|
To use the character “|” in a regular expression, it must be
“escaped” to prevent aptitude from creating an OR term from
it: “ |
(term
)
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
.
~Aarchive
Matches package versions which are available from an archive that matches
the regular expression archive
. For instance,
“~Atesting
” matches any package available
from the testing
archive.
~aåtgärd
Matches packages upon which the given action
is
going to be performed. action
can be
“install
”,
“upgrade
”,
“downgrade
”,
“remove
”,
“purge
”,
“hold
” (tests whether a package has been
placed on hold), or “keep
” (tests whether a
package will be unchanged).
Note that this only tests whether an action is actually queued up to be
performed on a package, not whether it could be
performed. Thus, for instance, ~aupgrade
matches exactly
those packages that you have already decided to upgrade, not packages which
could be upgraded in the future (for that, use
~U
).
~Btyp
Matches packages which have an unfulfilled (“broken”)
dependency of the given type
.
type
can be
“depends
”,
“predepends
”,
“recommends
”,
“suggests
”,
“conflicts
”, or
“replaces
”.
~b
Matches packages that are “broken”: they have an unfulfilled dependency, predependency, or conflict.
~Cterm
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.
~c
Matches packages which have been removed, but whose configuration files remain on the system (ie, they were removed but not purged).
~D[B][type
:]term
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 B
is present, only broken
dependencies will be considered.
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 version which matches
term
.
~dbeskrivning
Matches packages whose description matches the regular expression
description
.
~E
Matches Essential packages.
~F
This term does not match any package (“F” stands for “false”). [13]
~g
Matches packages which are not installed, or which were automatically installed and are not depended upon by any installed package.
~Gtagg
Matches packages whose Tag field matches the regular expression
tag
. For instance, the pattern
~Ggame::strategy
would match strategy games.
For more information on tags and debtags, see http://debtags.alioth.debian.org.
~i
Matches package versions which are currently installed.
Since all versions are tested by default, this normally matches packages which are currently installed.
~M
Matches packages which were automatically installed.
~mmaintainer
Matches packages whose Maintainer field matches the regular expression
maintainer
. For instance,
“~mjoeyh
” will find all packages maintained
by Joey Hess.
~N
Matches packages which are “new”.
~nnamn
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.
~Oursprung
Matches package versions whose origin matches the regular expression
origin
. For instance,
“!~Odebian
” will find any unofficial
packages on your system (packages not from the Debian archive).
~Pterm
Matches package versions which provide a package that matches the
name
. For instance,
“~Pmail-transport-agent
” will match all the
packages that provide
“mail-transport-agent
”.
~pprioritet
Matches packages whose priority is priority
;
priority
must be extra
,
important
, optional
,
required
, or standard
. For instance,
“~prequired
” matches packages whose priority
is “required
”.
~R[B][type
:]term
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 B
is present, only broken
dependencies will be considered.
If type
is
“provides
”, matches packages whose name is
provided by a package version matching term
.
Otherwise, matches packages which a package version matching
term
declares a dependency of type
type
upon.
~S filter
term
This term “narrows” the search to package versions matching
filter
. In particular, it matches any package
version which matches both filter
and
term
. The string value of the match is the
string value of term
.
~ssektion
Matches packages whose section matches the regular expression
section
.
~T
This term matches any package. For instance,
“~i~P~T
” matches installed packages which
are provided by any package.
~tfunktion
Matches packages that appear in a task whose name matches the regular
expression task
.
~U
This term matches any installed package which can be upgraded.
~Vversion
Matches any package version whose version number matches the regular
expression version
, with the exceptions noted
below. For instance, “~Vdebian
” matches
packages whose version contains “debian
”.
The following values of version
are treated
specially. To search for version numbers containing these values, preface
the value with a backslash; for instance, to find packages whose version
number contains CURRENT
, search for
\CURRENT
.
CURRENT
matches the currently installed version of a
package, if any.
CANDIDATE
matches the version, if any, of the package
that will be installed if you press + on the package or run
aptitude install
on it.
TARGET
matches the version of a package that is currently
targeted for installation, if any.
~v
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.
~Wterm
“Widens” the match: if the versions to match against have been
limited by an enclosing matcher (such as ~D
), these limits are
dropped. Thus, ~W
matches
a package version if term
term
matches
any version of that package.
[11]
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:
“\~|
”.
[12]
The backslash escapes \\
, \n
, and
\t
are also available.
[13]
This is provided largely for symmetry with ~T
.