1SYSTEMD-ESCAPE(1)               systemd-escape               SYSTEMD-ESCAPE(1)
2
3
4

NAME

6       systemd-escape - Escape strings for usage in system unit names
7

SYNOPSIS

9       systemd-escape [OPTIONS...] [STRING...]
10

DESCRIPTION

12       systemd-escape may be used to escape strings for inclusion in systemd
13       unit names. The command may be used to escape and to undo escaping of
14       strings.
15
16       The command takes any number of strings on the command line, and will
17       process them individually, one after the other. It will output them
18       separated by spaces to stdout.
19
20       By default this command will escape the strings passed, unless
21       --unescape is passed which results in the inverse operation being
22       applied. If --mangle a special mode of escaping is applied instead,
23       which assumes a string to be already escaped but will escape everything
24       that appears obviously non-escaped.
25

OPTIONS

27       The following options are understood:
28
29       --suffix=
30           Appends the specified unit type suffix to the escaped string. Takes
31           one of the unit types supported by systemd, such as ".service" or
32           ".mount". May not be used in conjunction with --template=,
33           --unescape or --mangle.
34
35       --template=
36           Inserts the escaped strings in a unit name template. Takes a unit
37           name template such as foobar@.service May not be used in
38           conjunction with --suffix=, --unescape or --mangle.
39
40       --path, -p
41           When escaping or unescaping a string, assume it refers to a file
42           system path. This enables special processing of the initial "/" of
43           the path.
44
45       --unescape
46           Instead of escaping the specified strings, undo the escaping,
47           reversing the operation. May not be used in conjunction with
48           --suffix=, --template= or --mangle.
49
50       --mangle
51           Like --escape, but only escape characters that are obviously not
52           escaped yet, and possibly automatically append an appropriate unit
53           type suffix to the string. May not be used in conjunction with
54           --suffix=, --template= or --unescape.
55
56       -h, --help
57           Print a short help text and exit.
58
59       --version
60           Print a short version string and exit.
61

EXAMPLES

63       Escape a single string:
64
65           $ systemd-escape 'Hallöchen, Meister'
66           Hall\xc3\xb6chen\x2c\x20Meister
67
68       To undo escaping on a single string:
69
70           $ systemd-escape -u 'Hall\xc3\xb6chen\x2c\x20Meister'
71           Hallöchen, Meister
72
73       To generate the mount unit for a path:
74
75           $ systemd-escape -p --suffix=mount "/tmp//waldi/foobar/"
76           tmp-waldi-foobar.mount
77
78       To generate instance names of three strings
79
80           $ systemd-escape --template=systemd-nspawn@.service 'My Container 1' 'containerb' 'container/III'
81           systemd-nspawn@My\x20Container\x201.service systemd-nspawn@containerb.service systemd-nspawn@container-III.service
82

EXIT STATUS

84       On success, 0 is returned, a non-zero failure code otherwise.
85

SEE ALSO

87       systemd(1), systemctl(1)
88
89
90
91systemd 219                                                  SYSTEMD-ESCAPE(1)
Impressum