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

EXAMPLES

127       apt remove ?garbage
128           Remove all packages that are automatically installed and no longer
129           needed - same as apt autoremove
130
131       apt purge ?config-files
132           Purge all packages that only have configuration files left
133
134       apt list '~i !~M (~slibs|~sperl|~spython)'
135           List all manually-installed packages in sections matching libs,
136           perl, or python.
137

MIGRATING FROM APTITUDE

139       Patterns in apt are heavily inspired by patterns in aptitude, but with
140       some tweaks:
141
142       ·   Syntax is uniform: If there is an opening parenthesis after a term,
143           it is always assumed to be the beginning of an argument list.
144
145           In aptitude, a syntactic form "?foo(bar)" could mean
146           "?and(?foo,bar)" if foo does not take an argument. In APT, this
147           will cause an error.
148
149       ·   Not all patterns are supported.
150
151       ·   Some additional patterns are available, for example, for finding
152           gstreamer codecs.
153
154       ·   Escaping terms with ~ is not supported.
155
156       ·   A trailing comma is allowed in argument lists
157
158       ·   ?narrow accepts infinite arguments
159
160       ·   foo cannot be used as a shortform for ?name(foo), as this can cause
161           typos to go unnoticed: Consider ?and(...,~poptional): this requires
162           the package to have required priority, but if you do not type the
163           ~, it would require the package name to contain poptional.
164
165       ·   Grouping patterns with (...)  or writing ?or(A,B) as A|B are not
166           supported. We do not believe that the use of | is that common, and
167           the grouping is not necessary without it.
168

SEE ALSO

170       apt-get(8), apt(8)
171

BUGS

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

AUTHOR

177       APT was written by the APT team <apt@packages.debian.org>.
178

AUTHORS

180       Jason Gunthorpe
181
182       APT team
183

NOTES

185        1. APT bug page
186           http://bugs.debian.org/src:apt
187
188
189
190APT 2.0.2                      04 February 2020                APT-PATTERNS(7)
Impressum