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