1SYSTEMD.SYNTAX(7)               systemd.syntax               SYSTEMD.SYNTAX(7)
2
3
4

NAME

6       systemd.syntax - General syntax of systemd configuration files
7

INTRODUCTION

9       This page describes the basic principles of configuration files used by
10       systemd(1) and related programs for:
11
12       •   systemd unit files, see systemd.unit(5), systemd.service(5),
13           systemd.socket(5), systemd.device(5), systemd.mount(5),
14           systemd.automount(5), systemd.swap(5), systemd.target(5),
15           systemd.path(5), systemd.timer(5), systemd.slice(5),
16           systemd.scope(5)
17
18       •   link files, see systemd.link(5)
19
20       •   netdev and network files, see systemd.netdev(5), systemd.network(5)
21
22       •   daemon config files, see systemd-system.conf(5), systemd-
23           user.conf(5), logind.conf(5), journald.conf(5), journal-
24           remote.conf(5), journal-upload.conf(5), systemd-sleep.conf(5),
25           timesyncd.conf(5)
26
27       •   nspawn files, see systemd.nspawn(5)
28
29       The syntax is inspired by XDG Desktop Entry Specification[1] .desktop
30       files, which are in turn inspired by Microsoft Windows .ini files.
31
32       Each file is a plain text file divided into sections, with
33       configuration entries in the style key=value. Whitespace immediately
34       before or after the "=" is ignored. Empty lines and lines starting with
35       "#" or ";" are ignored, which may be used for commenting.
36
37       Lines ending in a backslash are concatenated with the following line
38       while reading and the backslash is replaced by a space character. This
39       may be used to wrap long lines. The limit on line length is very large
40       (currently 1 MB), but it is recommended to avoid such long lines and
41       use multiple directives, variable substitution, or other mechanism as
42       appropriate for the given file type. When a comment line or lines
43       follow a line ending with a backslash, the comment block is ignored, so
44       the continued line is concatenated with whatever follows the comment
45       block.
46
47       Example 1.
48
49           [Section A]
50           KeyOne=value 1
51           KeyTwo=value 2
52
53           # a comment
54
55           [Section B]
56           Setting="something" "some thing" "..."
57           KeyTwo=value 2 \
58                  value 2 continued
59
60           [Section C]
61           KeyThree=value 3\
62           # this line is ignored
63           ; this line is ignored too
64                  value 3 continued
65
66       Boolean arguments used in configuration files can be written in various
67       formats. For positive settings the strings 1, yes, true and on are
68       equivalent. For negative settings, the strings 0, no, false and off are
69       equivalent.
70
71       Time span values encoded in configuration files can be written in
72       various formats. A stand-alone number specifies a time in seconds. If
73       suffixed with a time unit, the unit is honored. A concatenation of
74       multiple values with units is supported, in which case the values are
75       added up. Example: "50" refers to 50 seconds; "2min 200ms" refers to 2
76       minutes and 200 milliseconds, i.e. 120200 ms. The following time units
77       are understood: "s", "min", "h", "d", "w", "ms", "us". For details see
78       systemd.time(7).
79
80       Various settings are allowed to be specified more than once, in which
81       case the interpretation depends on the setting. Often, multiple
82       settings form a list, and setting to an empty value "resets", which
83       means that previous assignments are ignored. When this is allowed, it
84       is mentioned in the description of the setting. Note that using
85       multiple assignments to the same value makes the file incompatible with
86       parsers for the XDG .desktop file format.
87

QUOTING

89       For settings where quoting is allowed, the following general rules
90       apply: double quotes ("...") and single quotes ('...') may be used to
91       wrap a whole item (the opening quote may appear only at the beginning
92       or after whitespace that is not quoted, and the closing quote must be
93       followed by whitespace or the end of line), in which case everything
94       until the next matching quote becomes part of the same item. Quotes
95       themselves are removed. C-style escapes are supported. The table below
96       contains the list of known escape patterns. Only escape patterns which
97       match the syntax in the table are allowed; other patterns may be added
98       in the future and unknown patterns will result in a warning. In
99       particular, any backslashes should be doubled. Finally, a trailing
100       backslash ("\") may be used to merge lines, as described above. UTF-8
101       is accepted, and hence typical unicode characters do not need to be
102       escaped.
103
104       Table 1. Supported escapes
105       ┌─────────────┬────────────────────────────┐
106Literal      Actual value               
107       ├─────────────┼────────────────────────────┤
108       │"\a"         │ bell                       │
109       ├─────────────┼────────────────────────────┤
110       │"\b"         │ backspace                  │
111       ├─────────────┼────────────────────────────┤
112       │"\f"         │ form feed                  │
113       ├─────────────┼────────────────────────────┤
114       │"\n"         │ newline                    │
115       ├─────────────┼────────────────────────────┤
116       │"\r"         │ carriage return            │
117       ├─────────────┼────────────────────────────┤
118       │"\t"         │ tab                        │
119       ├─────────────┼────────────────────────────┤
120       │"\v"         │ vertical tab               │
121       ├─────────────┼────────────────────────────┤
122       │"\\"         │ backslash                  │
123       ├─────────────┼────────────────────────────┤
124       │"\""         │ double quotation mark      │
125       ├─────────────┼────────────────────────────┤
126       │"\'"         │ single quotation mark      │
127       ├─────────────┼────────────────────────────┤
128       │"\s"         │ space                      │
129       ├─────────────┼────────────────────────────┤
130       │"\xxx"       │ character number xx in     │
131       │             │ hexadecimal encoding       │
132       ├─────────────┼────────────────────────────┤
133       │"\nnn"       │ character number nnn in    │
134       │             │ octal encoding             │
135       ├─────────────┼────────────────────────────┤
136       │"\unnnn"     │ unicode code point nnnn in │
137       │             │ hexadecimal encoding       │
138       ├─────────────┼────────────────────────────┤
139       │"\Unnnnnnnn" │ unicode code point         │
140       │             │ nnnnnnnn in hexadecimal    │
141       │             │ encoding                   │
142       └─────────────┴────────────────────────────┘
143

SEE ALSO

145       systemd.time(7)
146

NOTES

148        1. XDG Desktop Entry Specification
149           https://standards.freedesktop.org/desktop-entry-spec/latest/
150
151
152
153systemd 253                                                  SYSTEMD.SYNTAX(7)
Impressum