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

PACKAGE RELATIONSHIP PATTERNS

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

EXAMPLES

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

MIGRATING FROM APTITUDE

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

SEE ALSO

193       apt-get(8), apt(8)
194

BUGS

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

AUTHOR

200       APT was written by the APT team <apt@packages.debian.org>.
201

AUTHORS

203       Jason Gunthorpe
204
205       APT team
206

NOTES

208        1. APT bug page
209           http://bugs.debian.org/src:apt
210
211
212
213APT 2.1.20                     27 December 2020                APT-PATTERNS(7)
Impressum