# phpman > man > systemd.syntax(7)

[SYSTEMD.SYNTAX(7)](https://www.chedong.com/phpMan.php/man/SYSTEMD.SYNTAX/7/markdown)                          systemd.syntax                          [SYSTEMD.SYNTAX(7)](https://www.chedong.com/phpMan.php/man/SYSTEMD.SYNTAX/7/markdown)



## NAME
       systemd.syntax - General syntax of systemd configuration files

## INTRODUCTION
       This page describes the basic principles of configuration files used by [**systemd**(1)](https://www.chedong.com/phpMan.php/man/systemd/1/markdown) and
       related programs for:

       •   systemd unit files, see [**systemd.unit**(5)](https://www.chedong.com/phpMan.php/man/systemd.unit/5/markdown), [**systemd.service**(5)](https://www.chedong.com/phpMan.php/man/systemd.service/5/markdown), [**systemd.socket**(5)](https://www.chedong.com/phpMan.php/man/systemd.socket/5/markdown),
           [**systemd.device**(5)](https://www.chedong.com/phpMan.php/man/systemd.device/5/markdown), [**systemd.mount**(5)](https://www.chedong.com/phpMan.php/man/systemd.mount/5/markdown), [**systemd.automount**(5)](https://www.chedong.com/phpMan.php/man/systemd.automount/5/markdown), [**systemd.swap**(5)](https://www.chedong.com/phpMan.php/man/systemd.swap/5/markdown),
           [**systemd.target**(5)](https://www.chedong.com/phpMan.php/man/systemd.target/5/markdown), [**systemd.path**(5)](https://www.chedong.com/phpMan.php/man/systemd.path/5/markdown), [**systemd.timer**(5)](https://www.chedong.com/phpMan.php/man/systemd.timer/5/markdown), [**systemd.slice**(5)](https://www.chedong.com/phpMan.php/man/systemd.slice/5/markdown), [**systemd.scope**(5)](https://www.chedong.com/phpMan.php/man/systemd.scope/5/markdown),
           [**systemd.nspawn**(5)](https://www.chedong.com/phpMan.php/man/systemd.nspawn/5/markdown)

       •   link files, see [**systemd.link**(5)](https://www.chedong.com/phpMan.php/man/systemd.link/5/markdown)

       •   netdev and network files, see [**systemd.netdev**(5)](https://www.chedong.com/phpMan.php/man/systemd.netdev/5/markdown), [**systemd.network**(5)](https://www.chedong.com/phpMan.php/man/systemd.network/5/markdown)

       •   daemon config files, see [**systemd-system.conf**(5)](https://www.chedong.com/phpMan.php/man/systemd-system.conf/5/markdown), [**systemd-user.conf**(5)](https://www.chedong.com/phpMan.php/man/systemd-user.conf/5/markdown), [**logind.conf**(5)](https://www.chedong.com/phpMan.php/man/logind.conf/5/markdown),
           [**journald.conf**(5)](https://www.chedong.com/phpMan.php/man/journald.conf/5/markdown), [**journal-remote.conf**(5)](https://www.chedong.com/phpMan.php/man/journal-remote.conf/5/markdown), [**journal-upload.conf**(5)](https://www.chedong.com/phpMan.php/man/journal-upload.conf/5/markdown), [**systemd-sleep.conf**(5)](https://www.chedong.com/phpMan.php/man/systemd-sleep.conf/5/markdown),
           [**timesyncd.conf**(5)](https://www.chedong.com/phpMan.php/man/timesyncd.conf/5/markdown)

       The syntax is inspired by **XDG** **Desktop** **Entry** **Specification**[1] .desktop files, which are in
       turn inspired by Microsoft Windows .ini files.

       Each file is a plain text file divided into sections, with configuration entries in the style
       _key_=_value_. Whitespace immediately before or after the "=" is ignored. Empty lines and lines
       starting with "#" or ";" are ignored, which may be used for commenting.

       Lines ending in a backslash are concatenated with the following line while reading and the
       backslash is replaced by a space character. This may be used to wrap long lines. The limit on
       line length is very large (currently 1 MB), but it is recommended to avoid such long lines
       and use multiple directives, variable substitution, or other mechanism as appropriate for the
       given file type. When a comment line or lines follow a line ending with a backslash, the
       comment block is ignored, so the continued line is concatenated with whatever follows the
       comment block.

### Example 1.

           [Section A]
           KeyOne=value 1
           KeyTwo=value 2

           # a comment

           [Section B]
           Setting="something" "some thing" "..."
           KeyTwo=value 2 \
                  value 2 continued

           [Section C]
           KeyThree=value 3\
           # this line is ignored
           ; this line is ignored too
                  value 3 continued

       Boolean arguments used in configuration files can be written in various formats. For positive
       settings the strings **1**, **yes**, **true** and **on** are equivalent. For negative settings, the strings
       **0**, **no**, **false** and **off** are equivalent.

       Time span values encoded in configuration files can be written in various formats. A
       stand-alone number specifies a time in seconds. If suffixed with a time unit, the unit is
       honored. A concatenation of multiple values with units is supported, in which case the values
       are added up. Example: "50" refers to 50 seconds; "2min 200ms" refers to 2 minutes and 200
       milliseconds, i.e. 120200 ms. The following time units are understood: "s", "min", "h", "d",
       "w", "ms", "us". For details see [**systemd.time**(7)](https://www.chedong.com/phpMan.php/man/systemd.time/7/markdown).

       Various settings are allowed to be specified more than once, in which case the interpretation
       depends on the setting. Often, multiple settings form a list, and setting to an empty value
       "resets", which means that previous assignments are ignored. When this is allowed, it is
       mentioned in the description of the setting. Note that using multiple assignments to the same
       value makes the file incompatible with parsers for the XDG .desktop file format.

## QUOTING
       For settings where quoting is allowed, the following general rules apply: double quotes
       ("...") and single quotes ('...') may be used to wrap a whole item (the opening quote may
       appear only at the beginning or after whitespace that is not quoted, and the closing quote
       must be followed by whitespace or the end of line), in which case everything until the next
       matching quote becomes part of the same item. Quotes themselves are removed. C-style escapes
       are supported. The table below contains the list of known escape patterns. Only escape
       patterns which match the syntax in the table are allowed; other patterns may be added in the
       future and unknown patterns will result in a warning. In particular, any backslashes should
       be doubled. Finally, a trailing backslash ("\") may be used to merge lines, as described
       above. UTF-8 is accepted, and hence typical unicode characters do not need to be escaped.

### Table 1. Supported escapes
       ┌─────────────┬────────────────────────────────┐
       │**Literal**      │ **Actual** **value**                   │
       ├─────────────┼────────────────────────────────┤
       │"\a"         │ bell                           │
       ├─────────────┼────────────────────────────────┤
       │"\b"         │ backspace                      │
       ├─────────────┼────────────────────────────────┤
       │"\f"         │ form feed                      │
       ├─────────────┼────────────────────────────────┤
       │"\n"         │ newline                        │
       ├─────────────┼────────────────────────────────┤
       │"\r"         │ carriage return                │
       ├─────────────┼────────────────────────────────┤
       │"\t"         │ tab                            │
       ├─────────────┼────────────────────────────────┤
       │"\v"         │ vertical tab                   │
       ├─────────────┼────────────────────────────────┤
       │"\\"         │ backslash                      │
       ├─────────────┼────────────────────────────────┤
       │"\""         │ double quotation mark          │
       ├─────────────┼────────────────────────────────┤
       │"\'"         │ single quotation mark          │
       ├─────────────┼────────────────────────────────┤
       │"\s"         │ space                          │
       ├─────────────┼────────────────────────────────┤
       │"\x_xx_"       │ character number _xx_ in         │
       │             │ hexadecimal encoding           │
       ├─────────────┼────────────────────────────────┤
       │"\_nnn_"       │ character number _nnn_ in octal  │
       │             │ encoding                       │
       ├─────────────┼────────────────────────────────┤
       │"\u_nnnn_"     │ unicode code point _nnnn_ in     │
       │             │ hexadecimal encoding           │
       ├─────────────┼────────────────────────────────┤
       │"\U_nnnnnnnn_" │ unicode code point _nnnnnnnn_ in │
       │             │ hexadecimal encoding           │
       └─────────────┴────────────────────────────────┘

## SEE ALSO
       [**systemd.time**(7)](https://www.chedong.com/phpMan.php/man/systemd.time/7/markdown)

## NOTES
        1. XDG Desktop Entry Specification
           <http://standards.freedesktop.org/desktop-entry-spec/latest/>



systemd 249                                                                        [SYSTEMD.SYNTAX(7)](https://www.chedong.com/phpMan.php/man/SYSTEMD.SYNTAX/7/markdown)
