1APT-PATTERNS(7)                       APT                      APT-PATTERNS(7)
2
3
4

NAME

6       apt-patterns - Syntax and semantics of apt search patterns
7

DESCRIPTION

9       Starting with version 2.0, APT provides support for patterns, which can
10       be used to query the apt cache for packages.
11

LOGIC PATTERNS

13       These patterns provide the basic means to combine other patterns into
14       more complex expressions, as well as ?true and ?false patterns.
15
16       ?and(PATTERN, PATTERN, ...), PATTERN PATTERN ...
17           Selects objects where all specified patterns match.
18
19       ?false, ~F
20           Selects nothing.
21
22       ?not(PATTERN), !PATTERN
23           Selects objects where PATTERN does not match.
24
25       ?or(PATTERN, PATTERN, ...), PATTERN | PATTERN | ...
26           Selects objects where at least one of the specified patterns match.
27
28       ?true, ~T
29           Selects all objects.
30
31       (PATTERN)
32           Selects the same as PATTERN, can be used to work around precedence,
33           for example, (~ramd64|~ri386)~nfoo
34

NARROWING PATTERNS

36       ?all-versions(PATTERN)
37           Selects packages where all versions match PATTERN. When matching
38           versions instead, same as PATTERN.
39
40       ?any-version(PATTERN)
41           Selects any version where the pattern matches on the version.
42
43           For example, while ?and(?version(1),?version(2)) matches a package
44           which has one version containing 1 and one version containing 2,
45           ?any-version(?and(?version(1),?version(2))) restricts the ?and to
46           act on the same version.
47
48       ?narrow(PATTERN...)
49           Selects any version matching all PATTERNs, short for
50           ?any-version(?and(PATTERN...)).
51

PACKAGE PATTERNS

53       These patterns select specific packages.
54
55       ?architecture(WILDCARD), ~rWILDCARD
56           Selects packages matching the specified architecture, which may
57           contain wildcards using any.
58
59       ?automatic, ~M
60           Selects packages that were installed automatically.
61
62       ?broken, ~b
63           Selects packages that have broken dependencies.
64
65       ?config-files, ~c
66           Selects packages that are not fully installed, but have solely
67           residual configuration files left.
68
69       ?essential, ~E
70           Selects packages that have Essential: yes set in their control
71           file.
72
73       ?exact-name(NAME)
74           Selects packages with the exact specified name.
75
76       ?garbage, ~g
77           Selects packages that can be removed automatically.
78
79       ?installed, ~i
80           Selects packages that are currently installed.
81
82       ?name(REGEX), ~nREGEX
83           Selects packages where the name matches the given regular
84           expression.
85
86       ?obsolete, ~o
87           Selects packages that no longer exist in repositories.
88
89       ?upgradable, ~U
90           Selects packages that can be upgraded (have a newer candidate).
91
92       ?virtual, ~v
93           Selects all virtual packages; that is packages without a version.
94           These exist when they are referenced somewhere in the archive, for
95           example because something depends on that name.
96

VERSION PATTERNS

98       These patterns select specific versions of a package.
99
100       ?archive(REGEX), ~AREGEX
101           Selects versions that come from the archive that matches the
102           specified regular expression. Archive, here, means the values after
103           a= in apt-cache policy.
104
105       ?origin(REGEX), ~OREGEX
106           Selects versions that come from the origin that matches the
107           specified regular expression. Origin, here, means the values after
108           o= in apt-cache policy.
109
110       ?section(REGEX), ~sREGEX
111           Selects versions where the section matches the specified regular
112           expression.
113
114       ?source-package(REGEX), ~eREGEX
115           Selects versions where the source package name matches the
116           specified regular expression.
117
118       ?source-version(REGEX)
119           Selects versions where the source package version matches the
120           specified regular expression.
121
122       ?version(REGEX), ~VREGEX
123           Selects versions where the version string matches the specified
124           regular expression.
125
126       ?priority(NAME), ~pNAME
127           Selects versions where the Priority string equals the given name.
128

PACKAGE RELATIONSHIP PATTERNS

130       These patterns match specific package versions that depend/conflict
131       with some other packages.
132
133       ?depends(PATTERN), ~DPATTERN, ?pre-depends(PATTERN),
134       ~DPre-Depends:PATTERN, ?suggests(PATTERN), ~DSuggests:PATTERN,
135       ?conflicts(PATTERN), ~DConflicts:PATTERN, ?replaces(PATTERN),
136       ~DReplaces:PATTERN, ?obsoletes(PATTERN), ~DObsoletes:PATTERN,
137       ?breaks(PATTERN), ~DBreaks:PATTERN, ?enhances(PATTERN),
138       ~DEnhances:PATTERN
139           Selects versions depending/pre-depending/suggesting/conflicting/etc
140           on/with/ packages matching PATTERN.
141
142       ?reverse-depType(PATTERN), ~RDepType:PATTERN
143           Opposite of ?depends and friends - selects all packages that have
144           reverse-dependencies (versions) matching PATTERN.
145
146           depType is one of the dependency types such as depends, so that we
147           don't have to repeat the entire list from the first paragraph here.
148

EXAMPLES

150       apt remove ?garbage
151           Remove all packages that are automatically installed and no longer
152           needed - same as apt autoremove
153
154       apt purge ?config-files
155           Purge all packages that only have configuration files left
156
157       apt list '~i !~M (~slibs|~sperl|~spython)'
158           List all manually-installed packages in sections matching libs,
159           perl, or python.
160

MIGRATING FROM APTITUDE

162       Patterns in apt are heavily inspired by patterns in aptitude, but with
163       some tweaks:
164
165       •   Syntax is uniform: If there is an opening parenthesis after a term,
166           it is always assumed to be the beginning of an argument list.
167
168           In aptitude, a syntactic form "?foo(bar)" could mean
169           "?and(?foo,bar)" if foo does not take an argument. In APT, this
170           will cause an error.
171
172       •   Not all patterns are supported.
173
174       •   Some additional patterns are available, for example, for finding
175           gstreamer codecs.
176
177       •   Escaping terms with ~ is not supported.
178
179       •   A trailing comma is allowed in argument lists
180
181       •   ?narrow accepts infinite arguments
182
183       •   foo cannot be used as a shortform for ?name(foo), as this can cause
184           typos to go unnoticed: Consider ?and(...,~poptional): this requires
185           the package to have required priority, but if you do not type the
186           ~, it would require the package name to contain poptional.
187
188       •   Grouping patterns with (...)  or writing ?or(A,B) as A|B are not
189           supported. We do not believe that the use of | is that common, and
190           the grouping is not necessary without it.
191
192       •   Dependency types for ~D and related operators need to be specified
193           in the canonical case.
194

SEE ALSO

196       apt-get(8), apt(8)
197

BUGS

199       APT bug page[1]. If you wish to report a bug in APT, please see
200       /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
201

AUTHOR

203       APT was written by the APT team <apt@packages.debian.org>.
204

AUTHORS

206       Jason Gunthorpe
207
208       APT team
209

NOTES

211        1. APT bug page
212           http://bugs.debian.org/src:apt
213
214
215
216APT 2.3.11                     07 September 2021               APT-PATTERNS(7)
Impressum