ELOGIND.SYNTAX(7)

πŸ“¦
version 255.24 Β· 3 versions
, in alpine 3.24

πŸŽ€ ELOGIND.SYNTAX πŸŽ€

okay bestie, so this is elogind.syntax(7) β€” the manual page that explains the general syntax of elogind configuration files. like, the grammar rules for every config file this whole family of programs eats. once you get this, you get all of them. iykyk. πŸ’…


✨ INTRODUCTION ✨

this page spills the basic principles of the config files used by elogind(8) and its related programs, for:

  • link files β€” see elogind.link(5) πŸ¦‹
  • netdev and network files β€” see elogind.netdev(5), elogind.network(5)
  • daemon config files β€” see logind.conf(5)

the syntax is lowkey inspired by the XDG Desktop Entry Specification[1] .desktop files, which are themselves inspired by Microsoft Windows .ini files. so it's giving "we've been doing this since forever" and honestly? iconic lineage. πŸ‘‘

so here's the vibe: each file is a plain text file, split up into sections, with configuration entries written in the style key=value. whitespace immediately before or after the = is ignored (don't stress about your spacing bestie, it does not care). empty lines and lines starting with # or ; are ignored too β€” that's your commenting behavior right there.

now, the ✨line continuation✨ moment: lines ending in a backslash get concatenated with the following line while reading, and the backslash is replaced by a space character. this is how you wrap long lines, periodt. the limit on line length is very large (currently 1 MB), but it's recommended to avoid such long lines and instead use multiple directives, variable substitution, or some other mechanism that's appropriate for the given file type. and listen β€” when a comment line (or lines!) follow a line ending with a backslash, the comment block is ignored, so the continued line gets concatenated with whatever follows the comment block. sneaky but true. πŸ’€

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

🌈 booleans, bestie

boolean arguments in config files can be written in various formats, slay. for positive settings the strings 1, yes, true and on are all equivalent. for negative settings the strings 0, no, false and off are equivalent. pick your fighter. 🫢

⏰ time spans

time span values encoded in configuration files can also be written in various formats:

  • a stand-alone number specifies a time in seconds
  • if it's suffixed with a time unit, that unit is honored
  • a concatenation of multiple values with units is supported β€” in which case the values get added up

example: "50" refers to 50 seconds; "2min 200ms" refers to 2 minutes and 200 milliseconds, i.e. 120200 ms. math queen behavior honestly.

the following time units are understood: "s", "min", "h", "d", "w", "ms", "us". for details see elogind.time(7). πŸ¦‹

πŸ” multiple assignments

various settings are allowed to be specified more than once, and in that case the interpretation depends on the setting. often, multiple settings form a list, and setting to an empty value "resets" β€” which means previous assignments are ignored. when this is allowed, it's mentioned in the description of the setting. so like, read the fine print, okay?

⚠️ note that using multiple assignments to the same value makes the file incompatible with parsers for the XDG .desktop file format. sharing is not always caring, bestie. 😭

πŸ’… QUOTING πŸ’…

for settings where quoting is allowed, these are the general rules, and they're actually pretty chill:

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's 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. the quotes themselves are removed. πŸŽ€

C-style escapes are supported. the list below has all the 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, exactly as described above. UTF-8 is accepted, so typical unicode characters do not need to be escaped. we love convenience. ✨

Table 1. Supported escapes

  • "\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
  • "\xxx" β†’ character number xx in hexadecimal encoding
  • "\nnn" β†’ character number nnn in octal encoding
  • "\unnnn" β†’ unicode code point nnnn in hexadecimal encoding
  • "\Unnnnnnnn" β†’ unicode code point nnnnnnnn in hexadecimal encoding

πŸ¦‹ SEE ALSO πŸ¦‹

elogind.time(7)


πŸ“ NOTES πŸ“

  1. XDG Desktop Entry Specification β€” https://standards.freedesktop.org/desktop-entry-spec/latest/

okay that's the whole page, you ate that honestly. this was elogind.syntax(7), brought to you by elogind 255.24 β€” go forth and format your config files correctly, bestie, mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from