]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.syntax.xml
repart: Use CRYPT_ACTIVATE_PRIVATE
[thirdparty/systemd.git] / man / systemd.syntax.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
eea10b26 3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
0f943ae4
ZJS
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
db9ecf05 7<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
0f943ae4
ZJS
8
9<refentry id="systemd.syntax">
10
11 <refentryinfo>
12 <title>systemd.syntax</title>
13 <productname>systemd</productname>
0f943ae4
ZJS
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>systemd.syntax</refentrytitle>
18 <manvolnum>7</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>systemd.syntax</refname>
23 <refpurpose>General syntax of systemd configuration files</refpurpose>
24 </refnamediv>
25
26 <refsect1>
27 <title>Introduction</title>
28
29 <para>This page describes the basic principles of configuration files used by
30 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
31 and related programs for:
32 <itemizedlist>
33 <listitem><para>systemd unit files, see
34 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
35 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
36 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
37 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
38 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
39 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
40 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
41 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
42 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
43 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
44 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
df7f714a 45 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>
6a5b75db 46 </para></listitem>
0f943ae4 47
d4de2b2a
ZJS
48 <listitem><para>link files, see
49 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
50 </para></listitem>
51
52 <listitem><para>netdev and network files, see
53 <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
54 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
55 </para></listitem>
56
0f943ae4
ZJS
57 <listitem><para>daemon config files, see
58 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
59 <citerefentry><refentrytitle>systemd-user.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
60 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
61 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
62 <citerefentry><refentrytitle>journal-remote.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
63 <citerefentry><refentrytitle>journal-upload.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
64 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
65 <citerefentry><refentrytitle>timesyncd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
df7f714a
SR
66 </para></listitem>
67
68 <listitem><para>nspawn files, see
69 <citerefentry><refentrytitle>systemd.nspawn</refentrytitle><manvolnum>5</manvolnum></citerefentry>
0f943ae4
ZJS
70 </para></listitem>
71 </itemizedlist>
72 </para>
73
74 <para>The syntax is inspired by
41d6f3bf 75 <ulink url="https://standards.freedesktop.org/desktop-entry-spec/latest/">XDG Desktop Entry Specification</ulink>
0f943ae4
ZJS
76 <filename>.desktop</filename> files, which are in turn inspired by Microsoft Windows
77 <filename>.ini</filename> files.
78 </para>
79
4d729e37
ZJS
80 <para>Each file is a plain text file divided into sections, with configuration entries in the style
81 <replaceable>key</replaceable>=<replaceable>value</replaceable>. Whitespace immediately before or after
82 the <literal>=</literal> is ignored. Empty lines and lines starting with <literal>#</literal> or
83 <literal>;</literal> are ignored, which may be used for commenting.</para>
0f943ae4
ZJS
84
85 <para>Lines ending in a backslash are concatenated with the following line while reading and the
86 backslash is replaced by a space character. This may be used to wrap long lines. The limit on
87 line length is very large (currently 1 MB), but it is recommended to avoid such long lines and
88 use multiple directives, variable substitution, or other mechanism as appropriate for the given
2ca4d779
ZJS
89 file type. When a comment line or lines follow a line ending with a backslash, the comment block
90 is ignored, so the continued line is concatenated with whatever follows the comment block.</para>
0f943ae4 91
74512bbc 92 <informalexample><programlisting>[Section A]
0f943ae4
ZJS
93KeyOne=value 1
94KeyTwo=value 2
95
96# a comment
97
98[Section B]
99Setting="something" "some thing" "…"
100KeyTwo=value 2 \
101 value 2 continued
2ca4d779
ZJS
102
103[Section C]
e9dd6984 104KeyThree=value 3\
2ca4d779
ZJS
105# this line is ignored
106; this line is ignored too
e9dd6984 107 value 3 continued
74512bbc 108</programlisting></informalexample>
0f943ae4 109
1c57fa90
YW
110 <para>Boolean arguments used in configuration files can be written in
111 various formats. For positive settings the strings
112 <option>1</option>, <option>yes</option>, <option>true</option>
113 and <option>on</option> are equivalent. For negative settings, the
114 strings <option>0</option>, <option>no</option>,
115 <option>false</option> and <option>off</option> are
116 equivalent.</para>
117
118 <para>Time span values encoded in configuration files can be written in various formats. A stand-alone
119 number specifies a time in seconds. If suffixed with a time unit, the unit is honored. A
120 concatenation of multiple values with units is supported, in which case the values are added
121 up. Example: <literal>50</literal> refers to 50 seconds; <literal>2min 200ms</literal> refers to
122 2 minutes and 200 milliseconds, i.e. 120200 ms. The following time units are understood:
123 <literal>s</literal>, <literal>min</literal>, <literal>h</literal>, <literal>d</literal>,
124 <literal>w</literal>, <literal>ms</literal>, <literal>us</literal>. For details see
125 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
126
0f943ae4
ZJS
127 <para>Various settings are allowed to be specified more than once, in which case the
128 interpretation depends on the setting. Often, multiple settings form a list, and setting to an
129 empty value "resets", which means that previous assignments are ignored. When this is allowed,
130 it is mentioned in the description of the setting. Note that using multiple assignments to the
131 same value makes the file incompatible with parsers for the XDG <filename>.desktop</filename>
132 file format.</para>
133 </refsect1>
134
4d729e37
ZJS
135 <refsect1>
136 <title>Quoting</title>
137
138 <para>For settings where quoting is allowed, the following general rules apply: double quotes ("…") and
139 single quotes ('…') may be used to wrap a whole item (the opening quote may appear only at the beginning
140 or after whitespace that is not quoted, and the closing quote must be followed by whitespace or the end
141 of line), in which case everything until the next matching quote becomes part of the same item. Quotes
1447d87a
ZJS
142 themselves are removed. C-style escapes are supported. The table below contains the list of known escape
143 patterns. Only escape patterns which match the syntax in the table are allowed; other patterns may be
144 added in the future and unknown patterns will result in a warning. In particular, any backslashes should
145 be doubled. Finally, a trailing backslash (<literal>\</literal>) may be used to merge lines, as described
146 above. UTF-8 is accepted, and hence typical unicode characters do not need to be escaped.</para>
4d729e37
ZJS
147
148 <table>
1447d87a 149 <title>Supported escapes</title>
4d729e37
ZJS
150 <tgroup cols='2'>
151 <colspec colname='escape' />
152 <colspec colname='meaning' />
153 <thead>
154 <row>
155 <entry>Literal</entry>
156 <entry>Actual value</entry>
157 </row>
158 </thead>
159 <tbody>
160 <row>
161 <entry><literal>\a</literal></entry>
162 <entry>bell</entry>
163 </row>
164 <row>
165 <entry><literal>\b</literal></entry>
166 <entry>backspace</entry>
167 </row>
168 <row>
169 <entry><literal>\f</literal></entry>
170 <entry>form feed</entry>
171 </row>
172 <row>
173 <entry><literal>\n</literal></entry>
174 <entry>newline</entry>
175 </row>
176 <row>
177 <entry><literal>\r</literal></entry>
178 <entry>carriage return</entry>
179 </row>
180 <row>
181 <entry><literal>\t</literal></entry>
182 <entry>tab</entry>
183 </row>
184 <row>
185 <entry><literal>\v</literal></entry>
186 <entry>vertical tab</entry>
187 </row>
188 <row>
189 <entry><literal>\\</literal></entry>
190 <entry>backslash</entry>
191 </row>
192 <row>
193 <entry><literal>\"</literal></entry>
194 <entry>double quotation mark</entry>
195 </row>
196 <row>
197 <entry><literal>\'</literal></entry>
198 <entry>single quotation mark</entry>
199 </row>
200 <row>
201 <entry><literal>\s</literal></entry>
202 <entry>space</entry>
203 </row>
204 <row>
205 <entry><literal>\x<replaceable>xx</replaceable></literal></entry>
206 <entry>character number <replaceable>xx</replaceable> in hexadecimal encoding</entry>
207 </row>
208 <row>
209 <entry><literal>\<replaceable>nnn</replaceable></literal></entry>
210 <entry>character number <replaceable>nnn</replaceable> in octal encoding</entry>
211 </row>
1447d87a
ZJS
212 <row>
213 <entry><literal>\u<replaceable>nnnn</replaceable></literal></entry>
214 <entry>unicode code point <replaceable>nnnn</replaceable> in hexadecimal encoding</entry>
215 </row>
216 <row>
217 <entry><literal>\U<replaceable>nnnnnnnn</replaceable></literal></entry>
218 <entry>unicode code point <replaceable>nnnnnnnn</replaceable> in hexadecimal encoding</entry>
219 </row>
4d729e37
ZJS
220 </tbody>
221 </tgroup>
222 </table>
223 </refsect1>
224
1c57fa90
YW
225 <refsect1>
226 <title>See Also</title>
227 <para>
228 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
229 </para>
230 </refsect1>
231
0f943ae4 232</refentry>