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