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       ?codename(REGEX)
106           Selects versions that come from the codename that matches the
107           specified regular expression. Codename, here, means the values
108           after n= in apt-cache policy.
109
110       ?origin(REGEX), ~OREGEX
111           Selects versions that come from the origin that matches the
112           specified regular expression. Origin, here, means the values after
113           o= in apt-cache policy.
114
115       ?section(REGEX), ~sREGEX
116           Selects versions where the section matches the specified regular
117           expression.
118
119       ?source-package(REGEX), ~eREGEX
120           Selects versions where the source package name matches the
121           specified regular expression.
122
123       ?source-version(REGEX)
124           Selects versions where the source package version matches the
125           specified regular expression.
126
127       ?version(REGEX), ~VREGEX
128           Selects versions where the version string matches the specified
129           regular expression.
130
131       ?priority(NAME), ~pNAME
132           Selects versions where the Priority string equals the given name.
133

PACKAGE RELATIONSHIP PATTERNS

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

EXAMPLES

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

MIGRATING FROM APTITUDE

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

SEE ALSO

201       apt-get(8), apt(8)
202

BUGS

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

AUTHOR

208       APT was written by the APT team <apt@packages.debian.org>.
209

AUTHORS

211       Jason Gunthorpe
212
213       APT team
214

NOTES

216        1. APT bug page
217           http://bugs.debian.org/src:apt
218
219
220
221APT 2.4.5                      26 December 2021                APT-PATTERNS(7)
Impressum