summaryrefslogtreecommitdiff
path: root/doc/apt-patterns.7.xml
blob: 327ea17d57ef50be955ff5bea5ed181d2c8a3deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % aptent SYSTEM "apt.ent"> %aptent;
<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
<!ENTITY % aptvendor SYSTEM "apt-vendor.ent"> %aptvendor;
]>

<refentry>
 <refentryinfo>
   &apt-author.jgunthorpe;
   &apt-author.team;
   &apt-email;
   &apt-product;
   <!-- The last update date -->
   <date>2019-08-15T00:00:00Z</date>
 </refentryinfo>

 <refmeta>
   <refentrytitle>apt-patterns</refentrytitle>
   <manvolnum>7</manvolnum>
   <refmiscinfo class="manual">APT</refmiscinfo>
 </refmeta>

 <!-- Man page title -->
 <refnamediv>
    <refname>apt-patterns</refname>
    <refpurpose>Syntax and semantics of apt search patterns</refpurpose>
 </refnamediv>

 <refsect1><title>Description</title>
   <para>
   Starting with version 2.0, <command>APT</command> provides support for
   patterns, which can be used to query the apt cache for packages.
   </para>
 </refsect1>

 <refsect1>
   <title>Logic patterns</title>
   <para>
      These patterns provide the basic means to combine other patterns into
      more complex expressions, as well as <code>?true</code> and <code>?false</code>
      patterns.
   </para>
   <variablelist>
     <varlistentry><term><code>?and(PATTERN, PATTERN, ...)</code></term>
     <listitem><para>Selects objects where all specified patterns match.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?false</code></term>
     <listitem><para>Selects nothing.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?not(PATTERN)</code></term>
     <listitem><para>Selects objects where PATTERN does not match.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?or(PATTERN, PATTERN, ...)</code></term>
     <listitem><para>Selects objects where at least one of the specified patterns match.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?true</code></term>
     <listitem><para>Selects all objects.</para></listitem>
     </varlistentry>
   </variablelist>
 </refsect1>
 <refsect1>
   <title>Package patterns</title>
   <para>
   These patterns select specific packages.
   </para>
   <variablelist>
     <varlistentry><term><code>?architecture(WILDCARD)</code></term>
     <listitem><para>Selects packages matching the specified architecture, which may contain wildcards using any.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?automatic</code></term>
     <listitem><para>Selects packages that were installed automatically.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?garbage</code></term>
     <listitem><para>Selects packages that can be removed automatically.</para></listitem>
     </varlistentry>
     <varlistentry><term><code>?name(REGEX)</code></term>
     <listitem><para>Selects packages where the name matches the given regular expression.</para></listitem>
     </varlistentry>
   </variablelist>
 </refsect1>


 <refsect1><title>Examples</title>
   <variablelist>
     <varlistentry><term><code>apt remove ?garbage</code></term>
     <listitem><para>Remove all packages that are automatically installed and no longer needed - same as apt autoremove</para></listitem>
     </varlistentry>
   </variablelist>
 </refsect1>

 <refsect1><title>Migrating from aptitude</title>
   <para>
   Patterns in apt are heavily inspired by patterns in aptitude, but with some tweaks:
   </para>
   <itemizedlist>
      <listitem>
         <para>Only long forms &mdash; the ones starting with ? &mdash; are supported</para>
      </listitem>
      <listitem>
         <para>
            Syntax is uniform: If there is an opening parenthesis after a term, it is always assumed to be the beginning of an argument list.
         </para>
         <para>
            In aptitude, a syntactic form <code>"?foo(bar)"</code> could mean <code>"?and(?foo,bar)"</code> if foo does not take an argument. In APT, this will cause an error.
         </para>
      </listitem>
      <listitem>
         <para>Not all patterns are supported.</para>
      </listitem>
      <listitem>
         <para>Some additional patterns are available, for example, for finding gstreamer codecs.</para>
      </listitem>
      <listitem>
         <para>Escaping terms with <code>~</code> is not supported.</para>
      </listitem>
      <listitem>
         <para>A trailing comma is allowed in argument lists</para>
      </listitem>
   </itemizedlist>
 </refsect1>

 <refsect1><title>See Also</title>
   <para>
   &apt-get;, &apt;
   </para>
 </refsect1>

 &manbugs;
 &manauthor;
</refentry>