]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemctl.xml
Merge pull request #10373 from poettering/systemd-io
[thirdparty/systemd.git] / man / systemctl.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7
8 <!--
9 SPDX-License-Identifier: LGPL-2.1+
10 -->
11
12 <refentry id="systemctl"
13 xmlns:xi="http://www.w3.org/2001/XInclude">
14
15 <refentryinfo>
16 <title>systemctl</title>
17 <productname>systemd</productname>
18 </refentryinfo>
19
20 <refmeta>
21 <refentrytitle>systemctl</refentrytitle>
22 <manvolnum>1</manvolnum>
23 </refmeta>
24
25 <refnamediv>
26 <refname>systemctl</refname>
27 <refpurpose>Control the systemd system and service manager</refpurpose>
28 </refnamediv>
29
30 <refsynopsisdiv>
31 <cmdsynopsis>
32 <command>systemctl</command>
33 <arg choice="opt" rep="repeat">OPTIONS</arg>
34 <arg choice="plain">COMMAND</arg>
35 <arg choice="opt" rep="repeat">UNIT</arg>
36 </cmdsynopsis>
37 </refsynopsisdiv>
38
39 <refsect1>
40 <title>Description</title>
41
42 <para><command>systemctl</command> may be used to introspect and
43 control the state of the <literal>systemd</literal> system and
44 service manager. Please refer to
45 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
46 for an introduction into the basic concepts and functionality this
47 tool manages.</para>
48 </refsect1>
49
50 <refsect1>
51 <title>Options</title>
52
53 <para>The following options are understood:</para>
54
55 <variablelist>
56 <varlistentry>
57 <term><option>-t</option></term>
58 <term><option>--type=</option></term>
59
60 <listitem>
61 <para>The argument should be a comma-separated list of unit
62 types such as <option>service</option> and
63 <option>socket</option>.
64 </para>
65
66 <para>If one of the arguments is a unit type, when listing
67 units, limit display to certain unit types. Otherwise, units
68 of all types will be shown.</para>
69
70 <para>As a special case, if one of the arguments is
71 <option>help</option>, a list of allowed values will be
72 printed and the program will exit.</para>
73 </listitem>
74 </varlistentry>
75
76 <varlistentry>
77 <term><option>--state=</option></term>
78
79 <listitem>
80 <para>The argument should be a comma-separated list of unit
81 LOAD, SUB, or ACTIVE states. When listing units, show only
82 those in the specified states. Use <option>--state=failed</option>
83 to show only failed units.</para>
84
85 <para>As a special case, if one of the arguments is
86 <option>help</option>, a list of allowed values will be
87 printed and the program will exit.</para>
88 </listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term><option>-p</option></term>
93 <term><option>--property=</option></term>
94
95 <listitem>
96 <para>When showing unit/job/manager properties with the
97 <command>show</command> command, limit display to properties
98 specified in the argument. The argument should be a
99 comma-separated list of property names, such as
100 <literal>MainPID</literal>. Unless specified, all known
101 properties are shown. If specified more than once, all
102 properties with the specified names are shown. Shell
103 completion is implemented for property names.</para>
104
105 <para>For the manager itself,
106 <command>systemctl show</command> will show all available
107 properties. Those properties are documented in
108 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
109 </para>
110
111 <para>Properties for units vary by unit type, so showing any
112 unit (even a non-existent one) is a way to list properties
113 pertaining to this type. Similarly, showing any job will list
114 properties pertaining to all jobs. Properties for units are
115 documented in
116 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
117 and the pages for individual unit types
118 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
120 etc.</para>
121 </listitem>
122 </varlistentry>
123
124 <varlistentry>
125 <term><option>-a</option></term>
126 <term><option>--all</option></term>
127
128 <listitem>
129 <para>When listing units with <command>list-units</command>, also show inactive units and
130 units which are following other units. When showing unit/job/manager properties, show all
131 properties regardless whether they are set or not.</para>
132
133 <para>To list all units installed in the file system, use the
134 <command>list-unit-files</command> command instead.</para>
135
136 <para>When listing units with <command>list-dependencies</command>, recursively show
137 dependencies of all dependent units (by default only dependencies of target units are
138 shown).</para>
139 </listitem>
140 </varlistentry>
141
142 <varlistentry>
143 <term><option>-r</option></term>
144 <term><option>--recursive</option></term>
145
146 <listitem>
147 <para>When listing units, also show units of local
148 containers. Units of local containers will be prefixed with
149 the container name, separated by a single colon character
150 (<literal>:</literal>).</para>
151 </listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><option>--reverse</option></term>
156
157 <listitem>
158 <para>Show reverse dependencies between units with
159 <command>list-dependencies</command>, i.e. follow
160 dependencies of type <varname>WantedBy=</varname>,
161 <varname>RequiredBy=</varname>,
162 <varname>PartOf=</varname>, <varname>BoundBy=</varname>,
163 instead of <varname>Wants=</varname> and similar.
164 </para>
165 </listitem>
166 </varlistentry>
167
168 <varlistentry>
169 <term><option>--after</option></term>
170
171 <listitem>
172 <para>With <command>list-dependencies</command>, show the
173 units that are ordered before the specified unit. In other
174 words, recursively list units following the
175 <varname>After=</varname> dependency.</para>
176
177 <para>Note that any <varname>After=</varname> dependency is
178 automatically mirrored to create a
179 <varname>Before=</varname> dependency. Temporal dependencies
180 may be specified explicitly, but are also created implicitly
181 for units which are <varname>WantedBy=</varname> targets
182 (see
183 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
184 and as a result of other directives (for example
185 <varname>RequiresMountsFor=</varname>). Both explicitly
186 and implicitly introduced dependencies are shown with
187 <command>list-dependencies</command>.</para>
188
189 <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs are
190 waiting for it. May be combined with <option>--before</option> to show both the jobs waiting for each job as
191 well as all jobs each job is waiting for.</para>
192 </listitem>
193 </varlistentry>
194
195 <varlistentry>
196 <term><option>--before</option></term>
197
198 <listitem>
199 <para>With <command>list-dependencies</command>, show the
200 units that are ordered after the specified unit. In other
201 words, recursively list units following the
202 <varname>Before=</varname> dependency.</para>
203
204 <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs it
205 is waiting for. May be combined with <option>--after</option> to show both the jobs waiting for each job as
206 well as all jobs each job is waiting for.</para>
207 </listitem>
208 </varlistentry>
209
210 <varlistentry>
211 <term><option>-l</option></term>
212 <term><option>--full</option></term>
213
214 <listitem>
215 <para>Do not ellipsize unit names, process tree entries,
216 journal output, or truncate unit descriptions in the output
217 of <command>status</command>, <command>list-units</command>,
218 <command>list-jobs</command>, and
219 <command>list-timers</command>.</para>
220 <para>Also, show installation targets in the output of
221 <command>is-enabled</command>.</para>
222 </listitem>
223 </varlistentry>
224
225 <varlistentry>
226 <term><option>--value</option></term>
227
228 <listitem>
229 <para>When printing properties with <command>show</command>,
230 only print the value, and skip the property name and
231 <literal>=</literal>.</para>
232 </listitem>
233 </varlistentry>
234
235 <varlistentry>
236 <term><option>--show-types</option></term>
237
238 <listitem>
239 <para>When showing sockets, show the type of the socket.</para>
240 </listitem>
241 </varlistentry>
242
243 <varlistentry>
244 <term><option>--job-mode=</option></term>
245
246 <listitem>
247 <para>When queuing a new job, this option controls how to deal with
248 already queued jobs. It takes one of <literal>fail</literal>,
249 <literal>replace</literal>,
250 <literal>replace-irreversibly</literal>,
251 <literal>isolate</literal>,
252 <literal>ignore-dependencies</literal>,
253 <literal>ignore-requirements</literal> or
254 <literal>flush</literal>. Defaults to
255 <literal>replace</literal>, except when the
256 <command>isolate</command> command is used which implies the
257 <literal>isolate</literal> job mode.</para>
258
259 <para>If <literal>fail</literal> is specified and a requested
260 operation conflicts with a pending job (more specifically:
261 causes an already pending start job to be reversed into a stop
262 job or vice versa), cause the operation to fail.</para>
263
264 <para>If <literal>replace</literal> (the default) is
265 specified, any conflicting pending job will be replaced, as
266 necessary.</para>
267
268 <para>If <literal>replace-irreversibly</literal> is specified,
269 operate like <literal>replace</literal>, but also mark the new
270 jobs as irreversible. This prevents future conflicting
271 transactions from replacing these jobs (or even being enqueued
272 while the irreversible jobs are still pending). Irreversible
273 jobs can still be cancelled using the <command>cancel</command>
274 command. This job mode should be used on any transaction which
275 pulls in <filename>shutdown.target</filename>.</para>
276
277 <para><literal>isolate</literal> is only valid for start
278 operations and causes all other units to be stopped when the
279 specified unit is started. This mode is always used when the
280 <command>isolate</command> command is used.</para>
281
282 <para><literal>flush</literal> will cause all queued jobs to
283 be canceled when the new job is enqueued.</para>
284
285 <para>If <literal>ignore-dependencies</literal> is specified,
286 then all unit dependencies are ignored for this new job and
287 the operation is executed immediately. If passed, no required
288 units of the unit passed will be pulled in, and no ordering
289 dependencies will be honored. This is mostly a debugging and
290 rescue tool for the administrator and should not be used by
291 applications.</para>
292
293 <para><literal>ignore-requirements</literal> is similar to
294 <literal>ignore-dependencies</literal>, but only causes the
295 requirement dependencies to be ignored, the ordering
296 dependencies will still be honored.</para>
297 </listitem>
298
299 </varlistentry>
300
301 <varlistentry>
302 <term><option>--fail</option></term>
303
304 <listitem>
305 <para>Shorthand for <option>--job-mode=</option>fail.</para>
306 <para>When used with the <command>kill</command> command,
307 if no units were killed, the operation results in an error.
308 </para>
309 </listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><option>-i</option></term>
314 <term><option>--ignore-inhibitors</option></term>
315
316 <listitem>
317 <para>When system shutdown or a sleep state is requested, ignore inhibitor locks. Applications can establish
318 inhibitor locks to avoid that certain important operations (such as CD burning or suchlike) are interrupted
319 by system shutdown or a sleep state. Any user may take these locks and privileged users may override these
320 locks. If any locks are taken, shutdown and sleep state requests will normally fail (unless privileged) and a
321 list of active locks is printed. However, if <option>--ignore-inhibitors</option> is specified, the
322 established locks are ignored and not shown, and the operation attempted anyway, possibly requiring
323 additional privileges.</para>
324 </listitem>
325 </varlistentry>
326
327 <varlistentry>
328 <term><option>--dry-run</option></term>
329
330 <listitem>
331 <para>Just print what would be done. Currently supported by verbs
332 <command>halt</command>, <command>poweroff</command>, <command>reboot</command>,
333 <command>kexec</command>, <command>suspend</command>, <command>hibernate</command>,
334 <command>hybrid-sleep</command>, <command>suspend-then-hibernate</command>,
335 <command>default</command>, <command>rescue</command>,
336 <command>emergency</command>, and <command>exit</command>.</para>
337 </listitem>
338 </varlistentry>
339
340 <varlistentry>
341 <term><option>-q</option></term>
342 <term><option>--quiet</option></term>
343
344 <listitem>
345 <para>Suppress printing of the results of various commands
346 and also the hints about truncated log lines. This does not
347 suppress output of commands for which the printed output is
348 the only result (like <command>show</command>). Errors are
349 always printed.</para>
350 </listitem>
351 </varlistentry>
352
353 <varlistentry>
354 <term><option>--no-block</option></term>
355
356 <listitem>
357 <para>Do not synchronously wait for the requested operation
358 to finish. If this is not specified, the job will be
359 verified, enqueued and <command>systemctl</command> will
360 wait until the unit's start-up is completed. By passing this
361 argument, it is only verified and enqueued. This option may not be
362 combined with <option>--wait</option>.</para>
363 </listitem>
364 </varlistentry>
365
366 <varlistentry>
367 <term><option>--wait</option></term>
368
369 <listitem>
370 <para>Synchronously wait for started units to terminate again.
371 This option may not be combined with <option>--no-block</option>.
372 Note that this will wait forever if any given unit never terminates
373 (by itself or by getting stopped explicitly); particularly services
374 which use <literal>RemainAfterExit=yes</literal>.</para>
375
376 <para>When used with <command>is-system-running</command>, wait
377 until the boot process is completed before returning.</para>
378 </listitem>
379 </varlistentry>
380
381 <xi:include href="user-system-options.xml" xpointer="user" />
382 <xi:include href="user-system-options.xml" xpointer="system" />
383
384 <varlistentry>
385 <term><option>--failed</option></term>
386
387 <listitem>
388 <para>List units in failed state. This is equivalent to
389 <option>--state=failed</option>.</para>
390 </listitem>
391 </varlistentry>
392
393 <varlistentry>
394 <term><option>--no-wall</option></term>
395
396 <listitem>
397 <para>Do not send wall message before halt, power-off and reboot.</para>
398 </listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term><option>--global</option></term>
403
404 <listitem>
405 <para>When used with <command>enable</command> and
406 <command>disable</command>, operate on the global user
407 configuration directory, thus enabling or disabling a unit
408 file globally for all future logins of all users.</para>
409 </listitem>
410 </varlistentry>
411
412 <varlistentry>
413 <term><option>--no-reload</option></term>
414
415 <listitem>
416 <para>When used with <command>enable</command> and
417 <command>disable</command>, do not implicitly reload daemon
418 configuration after executing the changes.</para>
419 </listitem>
420 </varlistentry>
421
422 <varlistentry>
423 <term><option>--no-ask-password</option></term>
424
425 <listitem>
426 <para>When used with <command>start</command> and related
427 commands, disables asking for passwords. Background services
428 may require input of a password or passphrase string, for
429 example to unlock system hard disks or cryptographic
430 certificates. Unless this option is specified and the
431 command is invoked from a terminal,
432 <command>systemctl</command> will query the user on the
433 terminal for the necessary secrets. Use this option to
434 switch this behavior off. In this case, the password must be
435 supplied by some other means (for example graphical password
436 agents) or the service might fail. This also disables
437 querying the user for authentication for privileged
438 operations.</para>
439 </listitem>
440 </varlistentry>
441
442 <varlistentry>
443 <term><option>--kill-who=</option></term>
444
445 <listitem>
446 <para>When used with <command>kill</command>, choose which
447 processes to send a signal to. Must be one of
448 <option>main</option>, <option>control</option> or
449 <option>all</option> to select whether to kill only the main
450 process, the control process or all processes of the
451 unit. The main process of the unit is the one that defines
452 the life-time of it. A control process of a unit is one that
453 is invoked by the manager to induce state changes of it. For
454 example, all processes started due to the
455 <varname>ExecStartPre=</varname>,
456 <varname>ExecStop=</varname> or
457 <varname>ExecReload=</varname> settings of service units are
458 control processes. Note that there is only one control
459 process per unit at a time, as only one state change is
460 executed at a time. For services of type
461 <varname>Type=forking</varname>, the initial process started
462 by the manager for <varname>ExecStart=</varname> is a
463 control process, while the process ultimately forked off by
464 that one is then considered the main process of the unit (if
465 it can be determined). This is different for service units
466 of other types, where the process forked off by the manager
467 for <varname>ExecStart=</varname> is always the main process
468 itself. A service unit consists of zero or one main process,
469 zero or one control process plus any number of additional
470 processes. Not all unit types manage processes of these
471 types however. For example, for mount units, control processes
472 are defined (which are the invocations of
473 <filename>&MOUNT_PATH;</filename> and
474 <filename>&UMOUNT_PATH;</filename>), but no main process
475 is defined. If omitted, defaults to
476 <option>all</option>.</para>
477 </listitem>
478
479 </varlistentry>
480
481 <varlistentry>
482 <term><option>-s</option></term>
483 <term><option>--signal=</option></term>
484
485 <listitem>
486 <para>When used with <command>kill</command>, choose which
487 signal to send to selected processes. Must be one of the
488 well-known signal specifiers such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or
489 <constant>SIGSTOP</constant>. If omitted, defaults to
490 <option>SIGTERM</option>.</para>
491 </listitem>
492 </varlistentry>
493
494 <varlistentry>
495 <term><option>-f</option></term>
496 <term><option>--force</option></term>
497
498 <listitem>
499 <para>When used with <command>enable</command>, overwrite
500 any existing conflicting symlinks.</para>
501
502 <para>When used with <command>edit</command>, create all of the
503 specified units which do not already exist.</para>
504
505 <para>When used with <command>halt</command>, <command>poweroff</command>, <command>reboot</command> or
506 <command>kexec</command>, execute the selected operation without shutting down all units. However, all
507 processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a
508 drastic but relatively safe option to request an immediate reboot. If <option>--force</option> is specified
509 twice for these operations (with the exception of <command>kexec</command>), they will be executed
510 immediately, without terminating any processes or unmounting any file systems. Warning: specifying
511 <option>--force</option> twice with any of these operations might result in data loss. Note that when
512 <option>--force</option> is specified twice the selected operation is executed by
513 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
514 succeed even when the system manager has crashed.</para>
515 </listitem>
516 </varlistentry>
517
518 <varlistentry>
519 <term><option>--message=</option></term>
520
521 <listitem>
522 <para>When used with <command>halt</command>, <command>poweroff</command> or <command>reboot</command>, set a
523 short message explaining the reason for the operation. The message will be logged together with the default
524 shutdown message.</para>
525 </listitem>
526 </varlistentry>
527
528 <varlistentry>
529 <term><option>--now</option></term>
530
531 <listitem>
532 <para>When used with <command>enable</command>, the units
533 will also be started. When used with <command>disable</command> or
534 <command>mask</command>, the units will also be stopped. The start
535 or stop operation is only carried out when the respective enable or
536 disable operation has been successful.</para>
537 </listitem>
538 </varlistentry>
539
540 <varlistentry>
541 <term><option>--root=</option></term>
542
543 <listitem>
544 <para>When used with
545 <command>enable</command>/<command>disable</command>/<command>is-enabled</command>
546 (and related commands), use the specified root path when looking for unit
547 files. If this option is present, <command>systemctl</command> will operate on
548 the file system directly, instead of communicating with the <command>systemd</command>
549 daemon to carry out changes.</para>
550 </listitem>
551
552 </varlistentry>
553
554 <varlistentry>
555 <term><option>--runtime</option></term>
556
557 <listitem>
558 <para>When used with <command>set-property</command>, make changes only
559 temporarily, so that they are lost on the next reboot.</para>
560
561 <para>Similarily, when used with <command>enable</command>, <command>mask</command>,
562 <command>edit</command> and related commands, make temporary changes, which are lost on
563 the next reboot. Changes are not made in subdirectories of <filename>/etc</filename>, but
564 in <filename>/run</filename>. The immediate effect is identical, however since the latter
565 is lost on reboot, the changes are lost too.</para>
566
567 <para>Note: this option cannot be used with <command>disable</command>,
568 <command>unmask</command>, <command>preset</command>, or <command>preset-all</command>,
569 because those operations sometimes need to remove symlinks under <filename>/etc</filename>
570 to have the desired effect, which would cause a persistent change.</para>
571 </listitem>
572 </varlistentry>
573
574 <varlistentry>
575 <term><option>--preset-mode=</option></term>
576
577 <listitem>
578 <para>Takes one of <literal>full</literal> (the default),
579 <literal>enable-only</literal>,
580 <literal>disable-only</literal>. When used with the
581 <command>preset</command> or <command>preset-all</command>
582 commands, controls whether units shall be disabled and
583 enabled according to the preset rules, or only enabled, or
584 only disabled.</para>
585 </listitem>
586 </varlistentry>
587
588 <varlistentry>
589 <term><option>-n</option></term>
590 <term><option>--lines=</option></term>
591
592 <listitem>
593 <para>When used with <command>status</command>, controls the number of journal lines to show, counting from
594 the most recent ones. Takes a positive integer argument, or 0 to disable journal output. Defaults to
595 10.</para>
596 </listitem>
597 </varlistentry>
598
599 <varlistentry>
600 <term><option>-o</option></term>
601 <term><option>--output=</option></term>
602
603 <listitem>
604 <para>When used with <command>status</command>, controls the
605 formatting of the journal entries that are shown. For the
606 available choices, see
607 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
608 Defaults to <literal>short</literal>.</para>
609 </listitem>
610 </varlistentry>
611
612 <varlistentry>
613 <term><option>--firmware-setup</option></term>
614
615 <listitem>
616 <para>When used with the <command>reboot</command> command,
617 indicate to the system's firmware to boot into setup
618 mode. Note that this is currently only supported on some EFI
619 systems and only if the system was booted in EFI
620 mode.</para>
621 </listitem>
622 </varlistentry>
623
624 <varlistentry>
625 <term><option>--plain</option></term>
626
627 <listitem>
628 <para>When used with <command>list-dependencies</command>,
629 <command>list-units</command> or <command>list-machines</command>,
630 the output is printed as a list instead of a tree, and the bullet
631 circles are omitted.</para>
632 </listitem>
633 </varlistentry>
634
635 <xi:include href="user-system-options.xml" xpointer="host" />
636 <xi:include href="user-system-options.xml" xpointer="machine" />
637
638 <xi:include href="standard-options.xml" xpointer="no-pager" />
639 <xi:include href="standard-options.xml" xpointer="no-legend" />
640 <xi:include href="standard-options.xml" xpointer="help" />
641 <xi:include href="standard-options.xml" xpointer="version" />
642 </variablelist>
643 </refsect1>
644
645 <refsect1>
646 <title>Commands</title>
647
648 <para>The following commands are understood:</para>
649
650 <refsect2>
651 <title>Unit Commands</title>
652
653 <variablelist>
654 <varlistentry>
655 <term><command>list-units</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
656
657 <listitem>
658 <para>List units that <command>systemd</command> currently has in memory. This includes units that are
659 either referenced directly or through a dependency, units that are pinned by applications programmatically,
660 or units that were active in the past and have failed. By default only units which are active, have pending
661 jobs, or have failed are shown; this can be changed with option <option>--all</option>. If one or more
662 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown. The units
663 that are shown are additionally filtered by <option>--type=</option> and <option>--state=</option> if those
664 options are specified.</para>
665
666 <para>Produces output similar to
667 <programlisting> UNIT LOAD ACTIVE SUB DESCRIPTION
668 sys-module-fuse.device loaded active plugged /sys/module/fuse
669 -.mount loaded active mounted Root Mount
670 boot-efi.mount loaded active mounted /boot/efi
671 systemd-journald.service loaded active running Journal Service
672 systemd-logind.service loaded active running Login Service
673 â—Ź user@1000.service loaded failed failed User Manager for UID 1000
674 …
675 systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
676
677 LOAD = Reflects whether the unit definition was properly loaded.
678 ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
679 SUB = The low-level unit activation state, values depend on unit type.
680
681 123 loaded units listed. Pass --all to see loaded but inactive units, too.
682 To show all installed unit files use 'systemctl list-unit-files'.
683 </programlisting>
684 The header and the last unit of a given type are underlined if the
685 terminal supports that. A colored dot is shown next to services which
686 were masked, not found, or otherwise failed.</para>
687
688 <para>The LOAD column shows the load state, one of <constant>loaded</constant>,
689 <constant>not-found</constant>, <constant>bad-setting</constant>, <constant>error</constant>,
690 <constant>masked</constant>. The ACTIVE columns shows the general unit state, one of
691 <constant>active</constant>, <constant>reloading</constant>, <constant>inactive</constant>,
692 <constant>failed</constant>, <constant>activating</constant>, <constant>deactivating</constant>. The SUB
693 column shows the unit-type-specific detailed state of the unit, possible values vary by unit type. The list
694 of possible LOAD, ACTIVE, and SUB states is not constant and new systemd releases may both add and remove
695 values. <programlisting>systemctl --state=help</programlisting> command maybe be used to display the
696 current set of possible values.</para>
697
698 <para>This is the default command.</para>
699 </listitem>
700 </varlistentry>
701
702 <varlistentry>
703 <term><command>list-sockets</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
704
705 <listitem>
706 <para>List socket units currently in memory, ordered by listening address. If one or more
707 <replaceable>PATTERN</replaceable>s are specified, only socket units matching one of them are
708 shown. Produces output similar to
709 <programlisting>
710 LISTEN UNIT ACTIVATES
711 /dev/initctl systemd-initctl.socket systemd-initctl.service
712 …
713 [::]:22 sshd.socket sshd.service
714 kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
715
716 5 sockets listed.</programlisting>
717 Note: because the addresses might contains spaces, this output
718 is not suitable for programmatic consumption.
719 </para>
720
721 <para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para>
722 </listitem>
723 </varlistentry>
724
725 <varlistentry>
726 <term><command>list-timers</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
727
728 <listitem>
729 <para>List timer units currently in memory, ordered by the time they elapse next. If one or more
730 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown.
731 Produces output similar to
732 <programlisting>
733 NEXT LEFT LAST PASSED UNIT ACTIVATES
734 n/a n/a Thu 2017-02-23 13:40:29 EST 3 days ago ureadahead-stop.timer ureadahead-stop.service
735 Sun 2017-02-26 18:55:42 EST 1min 14s left Thu 2017-02-23 13:54:44 EST 3 days ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
736 Sun 2017-02-26 20:37:16 EST 1h 42min left Sun 2017-02-26 11:56:36 EST 6h ago apt-daily.timer apt-daily.service
737 Sun 2017-02-26 20:57:49 EST 2h 3min left Sun 2017-02-26 11:56:36 EST 6h ago snapd.refresh.timer snapd.refresh.service
738 </programlisting>
739 </para>
740
741 <para><emphasis>NEXT</emphasis> shows the next time the timer will run.</para>
742 <para><emphasis>LEFT</emphasis> shows how long till the next time the timer runs.</para>
743 <para><emphasis>LAST</emphasis> shows the last time the timer ran.</para>
744 <para><emphasis>PASSED</emphasis> shows how long has passed since the timer last ran.</para>
745 <para><emphasis>UNIT</emphasis> shows the name of the timer</para>
746 <para><emphasis>ACTIVATES</emphasis> shows the name the service the timer activates when it runs.</para>
747
748 <para>Also see <option>--all</option> and <option>--state=</option>.</para>
749 </listitem>
750 </varlistentry>
751
752 <varlistentry>
753 <term><command>start <replaceable>PATTERN</replaceable>…</command></term>
754
755 <listitem>
756 <para>Start (activate) one or more units specified on the
757 command line.</para>
758
759 <para>Note that glob patterns operate on the set of primary names of units currently in memory. Units which
760 are not active and are not in a failed state usually are not in memory, and will not be matched by any
761 pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until
762 the instance has been started. Therefore, using glob patterns with <command>start</command> has limited
763 usefulness. Also, secondary alias names of units are not considered.</para>
764 </listitem>
765 </varlistentry>
766 <varlistentry>
767 <term><command>stop <replaceable>PATTERN</replaceable>…</command></term>
768
769 <listitem>
770 <para>Stop (deactivate) one or more units specified on the
771 command line.</para>
772 </listitem>
773 </varlistentry>
774 <varlistentry>
775 <term><command>reload <replaceable>PATTERN</replaceable>…</command></term>
776
777 <listitem>
778 <para>Asks all units listed on the command line to reload
779 their configuration. Note that this will reload the
780 service-specific configuration, not the unit configuration
781 file of systemd. If you want systemd to reload the
782 configuration file of a unit, use the
783 <command>daemon-reload</command> command. In other words:
784 for the example case of Apache, this will reload Apache's
785 <filename>httpd.conf</filename> in the web server, not the
786 <filename>apache.service</filename> systemd unit
787 file.</para>
788
789 <para>This command should not be confused with the
790 <command>daemon-reload</command> command.</para>
791 </listitem>
792
793 </varlistentry>
794 <varlistentry>
795 <term><command>restart <replaceable>PATTERN</replaceable>…</command></term>
796
797 <listitem>
798 <para>Stop and then start one or more units specified on the command line. If the units are not running
799 yet, they will be started.</para>
800
801 <para>Note that restarting a unit with this command does not necessarily flush out all of the unit's
802 resources before it is started again. For example, the per-service file descriptor storage facility (see
803 <varname>FileDescriptorStoreMax=</varname> in
804 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>) will
805 remain intact as long as the unit has a job pending, and is only cleared when the unit is fully stopped and
806 no jobs are pending anymore. If it is intended that the file descriptor store is flushed out, too, during a
807 restart operation an explicit <command>systemctl stop</command> command followed by <command>systemctl
808 start</command> should be issued.</para>
809 </listitem>
810 </varlistentry>
811 <varlistentry>
812 <term><command>try-restart <replaceable>PATTERN</replaceable>…</command></term>
813
814 <listitem>
815 <para>Stop and then start one or more units specified on the
816 command line if the units are running. This does nothing
817 if units are not running.</para>
818 <!-- Note that we don't document condrestart here, as that is just compatibility support, and we generally
819 don't document that. -->
820 </listitem>
821 </varlistentry>
822 <varlistentry>
823 <term><command>reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
824
825 <listitem>
826 <para>Reload one or more units if they support it. If not, stop and then start them instead. If the units
827 are not running yet, they will be started.</para>
828 </listitem>
829 </varlistentry>
830 <varlistentry>
831 <term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
832
833 <listitem>
834 <para>Reload one or more units if they support it. If not, stop and then start them instead. This does
835 nothing if the units are not running.</para>
836 <!-- Note that we don't document force-reload here, as that is just compatibility support, and we generally
837 don't document that. -->
838 </listitem>
839 </varlistentry>
840 <varlistentry>
841 <term><command>isolate <replaceable>UNIT</replaceable></command></term>
842
843 <listitem>
844 <para>Start the unit specified on the command line and its dependencies
845 and stop all others, unless they have
846 <option>IgnoreOnIsolate=yes</option> (see
847 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
848 If a unit name with no extension is given, an extension of
849 <literal>.target</literal> will be assumed.</para>
850
851 <para>This is similar to changing the runlevel in a
852 traditional init system. The <command>isolate</command>
853 command will immediately stop processes that are not enabled
854 in the new unit, possibly including the graphical
855 environment or terminal you are currently using.</para>
856
857 <para>Note that this is allowed only on units where
858 <option>AllowIsolate=</option> is enabled. See
859 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
860 for details.</para>
861 </listitem>
862 </varlistentry>
863 <varlistentry>
864 <term><command>kill <replaceable>PATTERN</replaceable>…</command></term>
865
866 <listitem>
867 <para>Send a signal to one or more processes of the
868 unit. Use <option>--kill-who=</option> to select which
869 process to kill. Use <option>--signal=</option> to select
870 the signal to send.</para>
871 </listitem>
872 </varlistentry>
873 <varlistentry>
874 <term><command>is-active <replaceable>PATTERN</replaceable>…</command></term>
875
876 <listitem>
877 <para>Check whether any of the specified units are active
878 (i.e. running). Returns an exit code
879 <constant>0</constant> if at least one is active, or
880 non-zero otherwise. Unless <option>--quiet</option> is
881 specified, this will also print the current unit state to
882 standard output.</para>
883 </listitem>
884 </varlistentry>
885 <varlistentry>
886 <term><command>is-failed <replaceable>PATTERN</replaceable>…</command></term>
887
888 <listitem>
889 <para>Check whether any of the specified units are in a
890 "failed" state. Returns an exit code
891 <constant>0</constant> if at least one has failed,
892 non-zero otherwise. Unless <option>--quiet</option> is
893 specified, this will also print the current unit state to
894 standard output.</para>
895 </listitem>
896 </varlistentry>
897 <varlistentry>
898 <term><command>status</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…]</optional></term>
899
900 <listitem>
901 <para>Show terse runtime status information about one or
902 more units, followed by most recent log data from the
903 journal. If no units are specified, show system status. If
904 combined with <option>--all</option>, also show the status of
905 all units (subject to limitations specified with
906 <option>-t</option>). If a PID is passed, show information
907 about the unit the process belongs to.</para>
908
909 <para>This function is intended to generate human-readable
910 output. If you are looking for computer-parsable output,
911 use <command>show</command> instead. By default, this
912 function only shows 10 lines of output and ellipsizes
913 lines to fit in the terminal window. This can be changed
914 with <option>--lines</option> and <option>--full</option>,
915 see above. In addition, <command>journalctl
916 --unit=<replaceable>NAME</replaceable></command> or
917 <command>journalctl
918 --user-unit=<replaceable>NAME</replaceable></command> use
919 a similar filter for messages and might be more
920 convenient.
921 </para>
922
923 <para>systemd implicitly loads units as necessary, so just running the <command>status</command> will
924 attempt to load a file. The command is thus not useful for determining if something was already loaded or
925 not. The units may possibly also be quickly unloaded after the operation is completed if there's no reason
926 to keep it in memory thereafter.
927 </para>
928
929 <example>
930 <title>Example output from systemctl status </title>
931
932 <programlisting>$ systemctl status bluetooth
933 â—Ź bluetooth.service - Bluetooth service
934 Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
935 Active: active (running) since Wed 2017-01-04 13:54:04 EST; 1 weeks 0 days ago
936 Docs: man:bluetoothd(8)
937 Main PID: 930 (bluetoothd)
938 Status: "Running"
939 Tasks: 1
940 Memory: 648.0K
941 CPU: 435ms
942 CGroup: /system.slice/bluetooth.service
943 └─930 /usr/lib/bluetooth/bluetoothd
944
945 Jan 12 10:46:45 example.com bluetoothd[8900]: Not enough free handles to register service
946 Jan 12 10:46:45 example.com bluetoothd[8900]: Current Time Service could not be registered
947 Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output error (5)
948 </programlisting>
949
950 <para>The dot ("â—Ź") uses color on supported terminals to summarize the unit state at a glance. White
951 indicates an <literal>inactive</literal> or <literal>deactivating</literal> state. Red indicates a
952 <literal>failed</literal> or <literal>error</literal> state and green indicates an
953 <literal>active</literal>, <literal>reloading</literal> or <literal>activating</literal> state.
954 </para>
955
956 <para>The "Loaded:" line in the output will show <literal>loaded</literal> if the unit has been loaded into
957 memory. Other possible values for "Loaded:" include: <literal>error</literal> if there was a problem
958 loading it, <literal>not-found</literal> if not unit file was found for this unit,
959 <literal>bad-setting</literal> if an essential unit file setting could not be parsed and
960 <literal>masked</literal> if the unit file has been masked. Along with showing the path to the unit file,
961 this line will also show the enablement state. Enabled commands start at boot. See the full table of
962 possible enablement states — including the definition of <literal>masked</literal> — in the documentation
963 for the <command>is-enabled</command> command.
964 </para>
965
966 <para>The "Active:" line shows active state. The value is usually <literal>active</literal> or
967 <literal>inactive</literal>. Active could mean started, bound, plugged in, etc depending on the unit type.
968 The unit could also be in process of changing states, reporting a state of <literal>activating</literal> or
969 <literal>deactivating</literal>. A special <literal>failed</literal> state is entered when the service
970 failed in some way, such as a crash, exiting with an error code or timing out. If the failed state is
971 entered the cause will be logged for later reference.</para>
972 </example>
973
974 </listitem>
975 </varlistentry>
976 <varlistentry>
977 <term><command>show</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>JOB</replaceable>…</optional></term>
978
979 <listitem>
980 <para>Show properties of one or more units, jobs, or the manager itself. If no argument is specified,
981 properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and
982 if a job ID is specified, properties of the job are shown. By default, empty properties are suppressed. Use
983 <option>--all</option> to show those too. To select specific properties to show, use
984 <option>--property=</option>. This command is intended to be used whenever computer-parsable output is
985 required. Use <command>status</command> if you are looking for formatted human-readable output.</para>
986
987 <para>Many properties shown by <command>systemctl show</command> map directly to configuration settings of
988 the system and service manager and its unit files. Note that the properties shown by the command are
989 generally more low-level, normalized versions of the original configuration settings and expose runtime
990 state in addition to configuration. For example, properties shown for service units include the service's
991 current main process identifier as <literal>MainPID</literal> (which is runtime state), and time settings
992 are always exposed as properties ending in the <literal>…USec</literal> suffix even if a matching
993 configuration options end in <literal>…Sec</literal>, because microseconds is the normalized time unit used
994 by the system and service manager.</para>
995 </listitem>
996 </varlistentry>
997 <varlistentry>
998 <term><command>cat <replaceable>PATTERN</replaceable>…</command></term>
999
1000 <listitem>
1001 <para>Show backing files of one or more units. Prints the
1002 "fragment" and "drop-ins" (source files) of units. Each
1003 file is preceded by a comment which includes the file
1004 name. Note that this shows the contents of the backing files
1005 on disk, which may not match the system manager's
1006 understanding of these units if any unit files were
1007 updated on disk and the <command>daemon-reload</command>
1008 command wasn't issued since.</para>
1009 </listitem>
1010 </varlistentry>
1011 <varlistentry>
1012 <term><command>set-property <replaceable>UNIT</replaceable> <replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable>…</command></term>
1013
1014 <listitem>
1015 <para>Set the specified unit properties at runtime where
1016 this is supported. This allows changing configuration
1017 parameter properties such as resource control settings at
1018 runtime. Not all properties may be changed at runtime, but
1019 many resource control settings (primarily those in
1020 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1021 may. The changes are applied immediately, and stored on disk
1022 for future boots, unless <option>--runtime</option> is
1023 passed, in which case the settings only apply until the
1024 next reboot. The syntax of the property assignment follows
1025 closely the syntax of assignments in unit files.</para>
1026
1027 <para>Example: <command>systemctl set-property foobar.service CPUShares=777</command></para>
1028
1029 <para>If the specified unit appears to be inactive, the
1030 changes will be only stored on disk as described
1031 previously hence they will be effective when the unit will
1032 be started.</para>
1033
1034 <para>Note that this command allows changing multiple
1035 properties at the same time, which is preferable over
1036 setting them individually. Like with unit file configuration
1037 settings, assigning an empty list will reset the property.
1038 </para>
1039 </listitem>
1040 </varlistentry>
1041
1042 <varlistentry>
1043 <term><command>help <replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…</command></term>
1044
1045 <listitem>
1046 <para>Show manual pages for one or more units, if
1047 available. If a PID is given, the manual pages for the unit
1048 the process belongs to are shown.</para>
1049 </listitem>
1050 </varlistentry>
1051
1052 <varlistentry>
1053 <term><command>reset-failed [<replaceable>PATTERN</replaceable>…]</command></term>
1054
1055 <listitem>
1056 <para>Reset the <literal>failed</literal> state of the specified units, or if no unit name is passed, reset
1057 the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code,
1058 terminating abnormally or timing out), it will automatically enter the <literal>failed</literal> state and
1059 its exit code and status is recorded for introspection by the administrator until the service is
1060 stopped/re-started or reset with this command.</para>
1061 </listitem>
1062 </varlistentry>
1063
1064 <varlistentry>
1065 <term>
1066 <command>list-dependencies</command>
1067 <optional><replaceable>UNIT</replaceable></optional>
1068 </term>
1069
1070 <listitem>
1071 <para>Shows units required and wanted by the specified
1072 unit. This recursively lists units following the
1073 <varname>Requires=</varname>,
1074 <varname>Requisite=</varname>,
1075 <varname>ConsistsOf=</varname>,
1076 <varname>Wants=</varname>, <varname>BindsTo=</varname>
1077 dependencies. If no unit is specified,
1078 <filename>default.target</filename> is implied.</para>
1079
1080 <para>By default, only target units are recursively
1081 expanded. When <option>--all</option> is passed, all other
1082 units are recursively expanded as well.</para>
1083
1084 <para>Options <option>--reverse</option>,
1085 <option>--after</option>, <option>--before</option>
1086 may be used to change what types of dependencies
1087 are shown.</para>
1088 </listitem>
1089 </varlistentry>
1090 </variablelist>
1091 </refsect2>
1092
1093 <refsect2>
1094 <title>Unit File Commands</title>
1095
1096 <variablelist>
1097 <varlistentry>
1098 <term><command>list-unit-files</command> <optional><replaceable>PATTERN…</replaceable></optional></term>
1099
1100 <listitem>
1101 <para>List unit files installed on the system, in combination with their enablement state (as reported by
1102 <command>is-enabled</command>). If one or more <replaceable>PATTERN</replaceable>s are specified, only unit
1103 files whose name matches one of them are shown (patterns matching unit file system paths are not
1104 supported).</para>
1105 </listitem>
1106 </varlistentry>
1107
1108 <varlistentry>
1109 <term><command>enable <replaceable>UNIT</replaceable>…</command></term>
1110 <term><command>enable <replaceable>PATH</replaceable>…</command></term>
1111
1112 <listitem>
1113 <para>Enable one or more units or unit instances. This will create a set of symlinks, as encoded in the
1114 <literal>[Install]</literal> sections of the indicated unit files. After the symlinks have been created,
1115 the system manager configuration is reloaded (in a way equivalent to <command>daemon-reload</command>), in
1116 order to ensure the changes are taken into account immediately. Note that this does
1117 <emphasis>not</emphasis> have the effect of also starting any of the units being enabled. If this is
1118 desired, combine this command with the <option>--now</option> switch, or invoke <command>start</command>
1119 with appropriate arguments later. Note that in case of unit instance enablement (i.e. enablement of units of
1120 the form <filename>foo@bar.service</filename>), symlinks named the same as instances are created in the
1121 unit configuration directory, however they point to the single template unit file they are instantiated
1122 from.</para>
1123
1124 <para>This command expects either valid unit names (in which case various unit file directories are
1125 automatically searched for unit files with appropriate names), or absolute paths to unit files (in which
1126 case these files are read directly). If a specified unit file is located outside of the usual unit file
1127 directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring
1128 it is found when requested by commands such as <command>start</command>. The file system where the linked
1129 unit files are located must be accessible when systemd is started (e.g. anything underneath
1130 <filename>/home</filename> or <filename>/var</filename> is not allowed, unless those directories are
1131 located on the root file system).</para>
1132
1133 <para>This command will print the file system operations executed. This output may be suppressed by passing
1134 <option>--quiet</option>.
1135 </para>
1136
1137 <para>Note that this operation creates only the symlinks suggested in the <literal>[Install]</literal>
1138 section of the unit files. While this command is the recommended way to manipulate the unit configuration
1139 directory, the administrator is free to make additional changes manually by placing or removing symlinks
1140 below this directory. This is particularly useful to create configurations that deviate from the suggested
1141 default installation. In this case, the administrator must make sure to invoke
1142 <command>daemon-reload</command> manually as necessary, in order to ensure the changes are taken into
1143 account.
1144 </para>
1145
1146 <para>Enabling units should not be confused with starting (activating) units, as done by the
1147 <command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without
1148 being started and started without being enabled. Enabling simply hooks the unit into various suggested
1149 places (for example, so that the unit is automatically started on boot or when a particular kind of
1150 hardware is plugged in). Starting actually spawns the daemon process (in case of service units), or binds
1151 the socket (in case of socket units), and so on.</para>
1152
1153 <para>Depending on whether <option>--system</option>, <option>--user</option>, <option>--runtime</option>,
1154 or <option>--global</option> is specified, this enables the unit for the system, for the calling user only,
1155 for only this boot of the system, or for all future logins of all users. Note that in the last case, no
1156 systemd daemon configuration is reloaded.</para>
1157
1158 <para>Using <command>enable</command> on masked units is not supported and results in an error.</para>
1159 </listitem>
1160 </varlistentry>
1161
1162 <varlistentry>
1163 <term><command>disable <replaceable>UNIT</replaceable>…</command></term>
1164
1165 <listitem>
1166 <para>Disables one or more units. This removes all symlinks to the unit files backing the specified units
1167 from the unit configuration directory, and hence undoes any changes made by <command>enable</command> or
1168 <command>link</command>. Note that this removes <emphasis>all</emphasis> symlinks to matching unit files,
1169 including manually created symlinks, and not just those actually created by <command>enable</command> or
1170 <command>link</command>. Note that while <command>disable</command> undoes the effect of
1171 <command>enable</command>, the two commands are otherwise not symmetric, as <command>disable</command> may
1172 remove more symlinks than a prior <command>enable</command> invocation of the same unit created.</para>
1173
1174 <para>This command expects valid unit names only, it does not accept paths to unit files.</para>
1175
1176 <para>In addition to the units specified as arguments, all units are disabled that are listed in the
1177 <varname>Also=</varname> setting contained in the <literal>[Install]</literal> section of any of the unit
1178 files being operated on.</para>
1179
1180 <para>This command implicitly reloads the system manager configuration after completing the operation. Note
1181 that this command does not implicitly stop the units that are being disabled. If this is desired, either
1182 combine this command with the <option>--now</option> switch, or invoke the <command>stop</command> command
1183 with appropriate arguments later.</para>
1184
1185 <para>This command will print information about the file system operations (symlink removals)
1186 executed. This output may be suppressed by passing <option>--quiet</option>.
1187 </para>
1188
1189 <para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option>
1190 and <option>--global</option> in a similar way as <command>enable</command>.</para>
1191 </listitem>
1192 </varlistentry>
1193
1194 <varlistentry>
1195 <term><command>reenable <replaceable>UNIT</replaceable>…</command></term>
1196
1197 <listitem>
1198 <para>Reenable one or more units, as specified on the command line. This is a combination of
1199 <command>disable</command> and <command>enable</command> and is useful to reset the symlinks a unit file is
1200 enabled with to the defaults configured in its <literal>[Install]</literal> section. This command expects
1201 a unit name only, it does not accept paths to unit files.</para>
1202 </listitem>
1203 </varlistentry>
1204
1205 <varlistentry>
1206 <term><command>preset <replaceable>UNIT</replaceable>…</command></term>
1207
1208 <listitem>
1209 <para>Reset the enable/disable status one or more unit files, as specified on
1210 the command line, to the defaults configured in the preset policy files. This
1211 has the same effect as <command>disable</command> or
1212 <command>enable</command>, depending how the unit is listed in the preset
1213 files.</para>
1214
1215 <para>Use <option>--preset-mode=</option> to control whether units shall be
1216 enabled and disabled, or only enabled, or only disabled.</para>
1217
1218 <para>If the unit carries no install information, it will be silently ignored
1219 by this command. <replaceable>UNIT</replaceable> must be the real unit name,
1220 any alias names are ignored silently.</para>
1221
1222 <para>For more information on the preset policy format, see
1223 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1224 For more information on the concept of presets, please consult the
1225 <ulink url="https://www.freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
1226 document.</para>
1227 </listitem>
1228 </varlistentry>
1229
1230 <varlistentry>
1231 <term><command>preset-all</command></term>
1232
1233 <listitem>
1234 <para>Resets all installed unit files to the defaults
1235 configured in the preset policy file (see above).</para>
1236
1237 <para>Use <option>--preset-mode=</option> to control
1238 whether units shall be enabled and disabled, or only
1239 enabled, or only disabled.</para>
1240 </listitem>
1241 </varlistentry>
1242
1243 <varlistentry>
1244 <term><command>is-enabled <replaceable>UNIT</replaceable>…</command></term>
1245
1246 <listitem>
1247 <para>Checks whether any of the specified unit files are
1248 enabled (as with <command>enable</command>). Returns an
1249 exit code of 0 if at least one is enabled, non-zero
1250 otherwise. Prints the current enable status (see table).
1251 To suppress this output, use <option>--quiet</option>.
1252 To show installation targets, use <option>--full</option>.
1253 </para>
1254
1255 <table>
1256 <title>
1257 <command>is-enabled</command> output
1258 </title>
1259
1260 <tgroup cols='3'>
1261 <thead>
1262 <row>
1263 <entry>Name</entry>
1264 <entry>Description</entry>
1265 <entry>Exit Code</entry>
1266 </row>
1267 </thead>
1268 <tbody>
1269 <row>
1270 <entry><literal>enabled</literal></entry>
1271 <entry morerows='1'>Enabled via <filename>.wants/</filename>, <filename>.requires/</filename> or <varname>Alias=</varname> symlinks (permanently in <filename>/etc/systemd/system/</filename>, or transiently in <filename>/run/systemd/system/</filename>).</entry>
1272 <entry morerows='1'>0</entry>
1273 </row>
1274 <row>
1275 <entry><literal>enabled-runtime</literal></entry>
1276 </row>
1277 <row>
1278 <entry><literal>linked</literal></entry>
1279 <entry morerows='1'>Made available through one or more symlinks to the unit file (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/system/</filename>), even though the unit file might reside outside of the unit file search path.</entry>
1280 <entry morerows='1'>&gt; 0</entry>
1281 </row>
1282 <row>
1283 <entry><literal>linked-runtime</literal></entry>
1284 </row>
1285 <row>
1286 <entry><literal>masked</literal></entry>
1287 <entry morerows='1'>Completely disabled, so that any start operation on it fails (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/systemd/</filename>).</entry>
1288 <entry morerows='1'>&gt; 0</entry>
1289 </row>
1290 <row>
1291 <entry><literal>masked-runtime</literal></entry>
1292 </row>
1293 <row>
1294 <entry><literal>static</literal></entry>
1295 <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry>
1296 <entry>0</entry>
1297 </row>
1298 <row>
1299 <entry><literal>indirect</literal></entry>
1300 <entry>The unit file itself is not enabled, but it has a non-empty <varname>Also=</varname> setting in the <literal>[Install]</literal> unit file section, listing other unit files that might be enabled, or it has an alias under a different name through a symlink that is not specified in Also=. For template unit file, an instance different than the one specified in <varname>DefaultInstance=</varname> is enabled.</entry>
1301 <entry>0</entry>
1302 </row>
1303 <row>
1304 <entry><literal>disabled</literal></entry>
1305 <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry>
1306 <entry>&gt; 0</entry>
1307 </row>
1308 <row>
1309 <entry><literal>generated</literal></entry>
1310 <entry>The unit file was generated dynamically via a generator tool. See <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>. Generated unit files may not be enabled, they are enabled implicitly by their generator.</entry>
1311 <entry>0</entry>
1312 </row>
1313 <row>
1314 <entry><literal>transient</literal></entry>
1315 <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry>
1316 <entry>0</entry>
1317 </row>
1318 <row>
1319 <entry><literal>bad</literal></entry>
1320 <entry>The unit file is invalid or another error occurred. Note that <command>is-enabled</command> will not actually return this state, but print an error message instead. However the unit file listing printed by <command>list-unit-files</command> might show it.</entry>
1321 <entry>&gt; 0</entry>
1322 </row>
1323 </tbody>
1324 </tgroup>
1325 </table>
1326
1327 </listitem>
1328 </varlistentry>
1329
1330 <varlistentry>
1331 <term><command>mask <replaceable>UNIT</replaceable>…</command></term>
1332
1333 <listitem>
1334 <para>Mask one or more units, as specified on the command line. This will link these unit files to
1335 <filename>/dev/null</filename>, making it impossible to start them. This is a stronger version of
1336 <command>disable</command>, since it prohibits all kinds of activation of the unit, including enablement
1337 and manual activation. Use this option with care. This honors the <option>--runtime</option> option to only
1338 mask temporarily until the next reboot of the system. The <option>--now</option> option may be used to
1339 ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit
1340 file paths.</para>
1341 </listitem>
1342 </varlistentry>
1343
1344 <varlistentry>
1345 <term><command>unmask <replaceable>UNIT</replaceable>…</command></term>
1346
1347 <listitem>
1348 <para>Unmask one or more unit files, as specified on the command line. This will undo the effect of
1349 <command>mask</command>. This command expects valid unit names only, it does not accept unit file
1350 paths.</para>
1351 </listitem>
1352 </varlistentry>
1353
1354 <varlistentry>
1355 <term><command>link <replaceable>PATH</replaceable>…</command></term>
1356
1357 <listitem>
1358 <para>Link a unit file that is not in the unit file search paths into the unit file search path. This
1359 command expects an absolute path to a unit file. The effect of this may be undone with
1360 <command>disable</command>. The effect of this command is that a unit file is made available for commands
1361 such as <command>start</command>, even though it is not installed directly in the unit search path. The
1362 file system where the linked unit files are located must be accessible when systemd is started
1363 (e.g. anything underneath <filename>/home</filename> or <filename>/var</filename> is not allowed, unless
1364 those directories are located on the root file system).</para>
1365 </listitem>
1366 </varlistentry>
1367
1368 <varlistentry>
1369 <term><command>revert <replaceable>UNIT</replaceable>…</command></term>
1370
1371 <listitem>
1372 <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration
1373 files that modify the specified units, as well as any user-configured unit file that overrides a matching
1374 vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories
1375 <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and
1376 runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and
1377 <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file
1378 located below <filename>/usr</filename>) any matching persistent or runtime unit file that overrides it is
1379 removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below
1380 <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit
1381 file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is
1382 unmasked.</para>
1383
1384 <para>Effectively, this command may be used to undo all changes made with <command>systemctl
1385 edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts
1386 the original unit file with its settings back in effect.</para>
1387 </listitem>
1388 </varlistentry>
1389
1390 <varlistentry>
1391 <term><command>add-wants <replaceable>TARGET</replaceable>
1392 <replaceable>UNIT</replaceable>…</command></term>
1393 <term><command>add-requires <replaceable>TARGET</replaceable>
1394 <replaceable>UNIT</replaceable>…</command></term>
1395
1396 <listitem>
1397 <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
1398 dependencies, respectively, to the specified
1399 <replaceable>TARGET</replaceable> for one or more units. </para>
1400
1401 <para>This command honors <option>--system</option>,
1402 <option>--user</option>, <option>--runtime</option> and
1403 <option>--global</option> in a way similar to
1404 <command>enable</command>.</para>
1405
1406 </listitem>
1407 </varlistentry>
1408
1409 <varlistentry>
1410 <term><command>edit <replaceable>UNIT</replaceable>…</command></term>
1411
1412 <listitem>
1413 <para>Edit a drop-in snippet or a whole replacement file if
1414 <option>--full</option> is specified, to extend or override the
1415 specified unit.</para>
1416
1417 <para>Depending on whether <option>--system</option> (the default),
1418 <option>--user</option>, or <option>--global</option> is specified,
1419 this command creates a drop-in file for each unit either for the system,
1420 for the calling user, or for all futures logins of all users. Then,
1421 the editor (see the "Environment" section below) is invoked on
1422 temporary files which will be written to the real location if the
1423 editor exits successfully.</para>
1424
1425 <para>If <option>--full</option> is specified, this will copy the
1426 original units instead of creating drop-in files.</para>
1427
1428 <para>If <option>--force</option> is specified and any units do
1429 not already exist, new unit files will be opened for editing.</para>
1430
1431 <para>If <option>--runtime</option> is specified, the changes will
1432 be made temporarily in <filename>/run</filename> and they will be
1433 lost on the next reboot.</para>
1434
1435 <para>If the temporary file is empty upon exit, the modification of
1436 the related unit is canceled.</para>
1437
1438 <para>After the units have been edited, systemd configuration is
1439 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1440 </para>
1441
1442 <para>Note that this command cannot be used to remotely edit units
1443 and that you cannot temporarily edit units which are in
1444 <filename>/etc</filename>, since they take precedence over
1445 <filename>/run</filename>.</para>
1446 </listitem>
1447 </varlistentry>
1448
1449 <varlistentry>
1450 <term><command>get-default</command></term>
1451
1452 <listitem>
1453 <para>Return the default target to boot into. This returns
1454 the target unit name <filename>default.target</filename>
1455 is aliased (symlinked) to.</para>
1456 </listitem>
1457 </varlistentry>
1458
1459 <varlistentry>
1460 <term><command>set-default <replaceable>TARGET</replaceable></command></term>
1461
1462 <listitem>
1463 <para>Set the default target to boot into. This sets
1464 (symlinks) the <filename>default.target</filename> alias
1465 to the given target unit.</para>
1466 </listitem>
1467 </varlistentry>
1468
1469 </variablelist>
1470 </refsect2>
1471
1472 <refsect2>
1473 <title>Machine Commands</title>
1474
1475 <variablelist>
1476 <varlistentry>
1477 <term><command>list-machines</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
1478
1479 <listitem>
1480 <para>List the host and all running local containers with
1481 their state. If one or more
1482 <replaceable>PATTERN</replaceable>s are specified, only
1483 containers matching one of them are shown.
1484 </para>
1485 </listitem>
1486 </varlistentry>
1487 </variablelist>
1488 </refsect2>
1489
1490 <refsect2>
1491 <title>Job Commands</title>
1492
1493 <variablelist>
1494 <varlistentry>
1495 <term><command>list-jobs <optional><replaceable>PATTERN…</replaceable></optional></command></term>
1496
1497 <listitem>
1498 <para>List jobs that are in progress. If one or more
1499 <replaceable>PATTERN</replaceable>s are specified, only
1500 jobs for units matching one of them are shown.</para>
1501
1502 <para>When combined with <option>--after</option> or <option>--before</option> the list is augmented with
1503 information on which other job each job is waiting for, and which other jobs are waiting for it, see
1504 above.</para>
1505 </listitem>
1506 </varlistentry>
1507 <varlistentry>
1508 <term><command>cancel <replaceable>JOB</replaceable>…</command></term>
1509
1510 <listitem>
1511 <para>Cancel one or more jobs specified on the command line
1512 by their numeric job IDs. If no job ID is specified, cancel
1513 all pending jobs.</para>
1514 </listitem>
1515 </varlistentry>
1516 </variablelist>
1517 </refsect2>
1518
1519 <refsect2>
1520 <title>Environment Commands</title>
1521
1522 <variablelist>
1523 <varlistentry>
1524 <term><command>show-environment</command></term>
1525
1526 <listitem>
1527 <para>Dump the systemd manager environment block. This is the environment
1528 block that is passed to all processes the manager spawns. The environment
1529 block will be dumped in straight-forward form suitable for sourcing into
1530 most shells. If no special characters or whitespace is present in the variable
1531 values, no escaping is performed, and the assignments have the form
1532 <literal>VARIABLE=value</literal>. If whitespace or characters which have
1533 special meaning to the shell are present, dollar-single-quote escaping is
1534 used, and assignments have the form <literal>VARIABLE=$'value'</literal>.
1535 This syntax is known to be supported by
1536 <citerefentry project='die-net'><refentrytitle>bash</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1537 <citerefentry project='die-net'><refentrytitle>zsh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1538 <citerefentry project='die-net'><refentrytitle>ksh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1539 and
1540 <citerefentry project='die-net'><refentrytitle>busybox</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
1541 <citerefentry project='die-net'><refentrytitle>ash</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1542 but not
1543 <citerefentry project='die-net'><refentrytitle>dash</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1544 or
1545 <citerefentry project='die-net'><refentrytitle>fish</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1546 </para>
1547 </listitem>
1548 </varlistentry>
1549 <varlistentry>
1550 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>…</command></term>
1551
1552 <listitem>
1553 <para>Set one or more systemd manager environment variables,
1554 as specified on the command line.</para>
1555 </listitem>
1556 </varlistentry>
1557 <varlistentry>
1558 <term><command>unset-environment <replaceable>VARIABLE</replaceable>…</command></term>
1559
1560 <listitem>
1561 <para>Unset one or more systemd manager environment
1562 variables. If only a variable name is specified, it will be
1563 removed regardless of its value. If a variable and a value
1564 are specified, the variable is only removed if it has the
1565 specified value.</para>
1566 </listitem>
1567 </varlistentry>
1568 <varlistentry>
1569 <term>
1570 <command>import-environment</command>
1571 <optional><replaceable>VARIABLE…</replaceable></optional>
1572 </term>
1573
1574 <listitem>
1575 <para>Import all, one or more environment variables set on
1576 the client into the systemd manager environment block. If
1577 no arguments are passed, the entire environment block is
1578 imported. Otherwise, a list of one or more environment
1579 variable names should be passed, whose client-side values
1580 are then imported into the manager's environment
1581 block.</para>
1582 </listitem>
1583 </varlistentry>
1584 </variablelist>
1585 </refsect2>
1586
1587 <refsect2>
1588 <title>Manager Lifecycle Commands</title>
1589
1590 <variablelist>
1591 <varlistentry>
1592 <term><command>daemon-reload</command></term>
1593
1594 <listitem>
1595 <para>Reload the systemd manager configuration. This will
1596 rerun all generators (see
1597 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
1598 reload all unit files, and recreate the entire dependency
1599 tree. While the daemon is being reloaded, all sockets
1600 systemd listens on behalf of user configuration will stay
1601 accessible.</para>
1602
1603 <para>This command should not be confused with the
1604 <command>reload</command> command.</para>
1605 </listitem>
1606 </varlistentry>
1607 <varlistentry>
1608 <term><command>daemon-reexec</command></term>
1609
1610 <listitem>
1611 <para>Reexecute the systemd manager. This will serialize the
1612 manager state, reexecute the process and deserialize the
1613 state again. This command is of little use except for
1614 debugging and package upgrades. Sometimes, it might be
1615 helpful as a heavy-weight <command>daemon-reload</command>.
1616 While the daemon is being reexecuted, all sockets systemd listening
1617 on behalf of user configuration will stay accessible.
1618 </para>
1619 </listitem>
1620 </varlistentry>
1621 </variablelist>
1622 </refsect2>
1623
1624 <refsect2>
1625 <title>System Commands</title>
1626
1627 <variablelist>
1628 <varlistentry>
1629 <term><command>is-system-running</command></term>
1630
1631 <listitem>
1632 <para>Checks whether the system is operational. This
1633 returns success (exit code 0) when the system is fully up
1634 and running, specifically not in startup, shutdown or
1635 maintenance mode, and with no failed services. Failure is
1636 returned otherwise (exit code non-zero). In addition, the
1637 current state is printed in a short string to standard
1638 output, see the table below. Use <option>--quiet</option> to
1639 suppress this output.</para>
1640
1641 <para>Use <option>--wait</option> to wait until the boot
1642 process is completed before printing the current state and
1643 returning the appropriate error status. If <option>--wait</option>
1644 is in use, states <varname>initializing</varname> or
1645 <varname>starting</varname> will not be reported, instead
1646 the command will block until a later state (such as
1647 <varname>running</varname> or <varname>degraded</varname>)
1648 is reached.</para>
1649
1650 <table>
1651 <title><command>is-system-running</command> output</title>
1652 <tgroup cols='3'>
1653 <colspec colname='name'/>
1654 <colspec colname='description'/>
1655 <colspec colname='exit-code'/>
1656 <thead>
1657 <row>
1658 <entry>Name</entry>
1659 <entry>Description</entry>
1660 <entry>Exit Code</entry>
1661 </row>
1662 </thead>
1663 <tbody>
1664 <row>
1665 <entry><varname>initializing</varname></entry>
1666 <entry><para>Early bootup, before
1667 <filename>basic.target</filename> is reached
1668 or the <varname>maintenance</varname> state entered.
1669 </para></entry>
1670 <entry>&gt; 0</entry>
1671 </row>
1672 <row>
1673 <entry><varname>starting</varname></entry>
1674 <entry><para>Late bootup, before the job queue
1675 becomes idle for the first time, or one of the
1676 rescue targets are reached.</para></entry>
1677 <entry>&gt; 0</entry>
1678 </row>
1679 <row>
1680 <entry><varname>running</varname></entry>
1681 <entry><para>The system is fully
1682 operational.</para></entry>
1683 <entry>0</entry>
1684 </row>
1685 <row>
1686 <entry><varname>degraded</varname></entry>
1687 <entry><para>The system is operational but one or more
1688 units failed.</para></entry>
1689 <entry>&gt; 0</entry>
1690 </row>
1691 <row>
1692 <entry><varname>maintenance</varname></entry>
1693 <entry><para>The rescue or emergency target is
1694 active.</para></entry>
1695 <entry>&gt; 0</entry>
1696 </row>
1697 <row>
1698 <entry><varname>stopping</varname></entry>
1699 <entry><para>The manager is shutting
1700 down.</para></entry>
1701 <entry>&gt; 0</entry>
1702 </row>
1703 <row>
1704 <entry><varname>offline</varname></entry>
1705 <entry><para>The manager is not
1706 running. Specifically, this is the operational
1707 state if an incompatible program is running as
1708 system manager (PID 1).</para></entry>
1709 <entry>&gt; 0</entry>
1710 </row>
1711 <row>
1712 <entry><varname>unknown</varname></entry>
1713 <entry><para>The operational state could not be
1714 determined, due to lack of resources or another
1715 error cause.</para></entry>
1716 <entry>&gt; 0</entry>
1717 </row>
1718 </tbody>
1719 </tgroup>
1720 </table>
1721 </listitem>
1722 </varlistentry>
1723
1724 <varlistentry>
1725 <term><command>default</command></term>
1726
1727 <listitem>
1728 <para>Enter default mode. This is equivalent to <command>systemctl isolate default.target</command>. This
1729 operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para>
1730 </listitem>
1731 </varlistentry>
1732
1733 <varlistentry>
1734 <term><command>rescue</command></term>
1735
1736 <listitem>
1737 <para>Enter rescue mode. This is equivalent to <command>systemctl isolate rescue.target</command>. This
1738 operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para>
1739 </listitem>
1740 </varlistentry>
1741 <varlistentry>
1742 <term><command>emergency</command></term>
1743
1744 <listitem>
1745 <para>Enter emergency mode. This is equivalent to <command>systemctl isolate
1746 emergency.target</command>. This operation is blocking by default, use <option>--no-block</option> to
1747 request asynchronous behavior.</para>
1748 </listitem>
1749 </varlistentry>
1750 <varlistentry>
1751 <term><command>halt</command></term>
1752
1753 <listitem>
1754 <para>Shut down and halt the system. This is mostly equivalent to <command>systemctl start halt.target
1755 --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This command is
1756 asynchronous; it will return after the halt operation is enqueued, without waiting for it to complete. Note
1757 that this operation will simply halt the OS kernel after shutting down, leaving the hardware powered
1758 on. Use <command>systemctl poweroff</command> for powering off the system (see below).</para>
1759
1760 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1761 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1762 system halt. If <option>--force</option> is specified twice, the operation is immediately executed without
1763 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1764 <option>--force</option> is specified twice the halt operation is executed by <command>systemctl</command>
1765 itself, and the system manager is not contacted. This means the command should succeed even when the system
1766 manager has crashed.</para>
1767 </listitem>
1768 </varlistentry>
1769 <varlistentry>
1770 <term><command>poweroff</command></term>
1771
1772 <listitem>
1773 <para>Shut down and power-off the system. This is mostly equivalent to <command>systemctl start
1774 poweroff.target --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all
1775 users. This command is asynchronous; it will return after the power-off operation is enqueued, without
1776 waiting for it to complete.</para>
1777
1778 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1779 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1780 powering off. If <option>--force</option> is specified twice, the operation is immediately executed without
1781 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1782 <option>--force</option> is specified twice the power-off operation is executed by
1783 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1784 succeed even when the system manager has crashed.</para>
1785 </listitem>
1786 </varlistentry>
1787 <varlistentry>
1788 <term><command>reboot</command> <optional><replaceable>arg</replaceable></optional></term>
1789
1790 <listitem>
1791 <para>Shut down and reboot the system. This is mostly equivalent to <command>systemctl start reboot.target
1792 --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This
1793 command is asynchronous; it will return after the reboot operation is enqueued, without waiting for it to
1794 complete.</para>
1795
1796 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1797 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1798 reboot. If <option>--force</option> is specified twice, the operation is immediately executed without
1799 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1800 <option>--force</option> is specified twice the reboot operation is executed by
1801 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1802 succeed even when the system manager has crashed.</para>
1803
1804 <para>If the optional argument <replaceable>arg</replaceable> is given, it will be passed as the optional
1805 argument to the <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1806 system call. The value is architecture and firmware specific. As an example, <literal>recovery</literal>
1807 might be used to trigger system recovery, and <literal>fota</literal> might be used to trigger a
1808 <quote>firmware over the air</quote> update.</para>
1809 </listitem>
1810 </varlistentry>
1811
1812 <varlistentry>
1813 <term><command>kexec</command></term>
1814
1815 <listitem>
1816 <para>Shut down and reboot the system via <command>kexec</command>. This is equivalent to
1817 <command>systemctl start kexec.target --job-mode=replace-irreversibly --no-block</command>. This command is
1818 asynchronous; it will return after the reboot operation is enqueued, without waiting for it to
1819 complete.</para>
1820
1821 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1822 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1823 reboot.</para>
1824 </listitem>
1825 </varlistentry>
1826
1827 <varlistentry>
1828 <term><command>exit</command> <optional><replaceable>EXIT_CODE</replaceable></optional></term>
1829
1830 <listitem>
1831 <para>Ask the service manager to quit. This is only supported for user service managers (i.e. in
1832 conjunction with the <option>--user</option> option) or in containers and is equivalent to
1833 <command>poweroff</command> otherwise. This command is asynchronous; it will return after the exit
1834 operation is enqueued, without waiting for it to complete.</para>
1835
1836 <para>The service manager will exit with the specified exit code, if
1837 <replaceable>EXIT_CODE</replaceable> is passed.</para>
1838 </listitem>
1839 </varlistentry>
1840
1841 <varlistentry>
1842 <term><command>switch-root</command> <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></term>
1843
1844 <listitem>
1845 <para>Switches to a different root directory and executes a new system manager process below it. This is
1846 intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager
1847 process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host
1848 volume. This call takes two arguments: the directory that is to become the new root directory, and the path
1849 to the new system manager binary below it to execute as PID 1. If the latter is omitted or the empty
1850 string, a systemd binary will automatically be searched for and used as init. If the system manager path is
1851 omitted, equal to the empty string or identical to the path to the systemd binary, the state of the
1852 initrd's system manager process is passed to the main system manager, which allows later introspection of
1853 the state of the services involved in the initrd boot phase.</para>
1854 </listitem>
1855 </varlistentry>
1856
1857 <varlistentry>
1858 <term><command>suspend</command></term>
1859
1860 <listitem>
1861 <para>Suspend the system. This will trigger activation of the special target unit
1862 <filename>suspend.target</filename>. This command is asynchronous, and will return after the suspend
1863 operation is successfully enqueued. It will not wait for the suspend/resume cycle to complete.</para>
1864 </listitem>
1865 </varlistentry>
1866
1867 <varlistentry>
1868 <term><command>hibernate</command></term>
1869
1870 <listitem>
1871 <para>Hibernate the system. This will trigger activation of the special target unit
1872 <filename>hibernate.target</filename>. This command is asynchronous, and will return after the hibernation
1873 operation is successfully enqueued. It will not wait for the hibernate/thaw cycle to complete.</para>
1874 </listitem>
1875 </varlistentry>
1876
1877 <varlistentry>
1878 <term><command>hybrid-sleep</command></term>
1879
1880 <listitem>
1881 <para>Hibernate and suspend the system. This will trigger activation of the special target unit
1882 <filename>hybrid-sleep.target</filename>. This command is asynchronous, and will return after the hybrid
1883 sleep operation is successfully enqueued. It will not wait for the sleep/wake-up cycle to complete.</para>
1884 </listitem>
1885 </varlistentry>
1886
1887 <varlistentry>
1888 <term><command>suspend-then-hibernate</command></term>
1889
1890 <listitem>
1891 <para>Suspend the system and hibernate it after the delay specified in <filename>systemd-sleep.conf</filename>.
1892 This will trigger activation of the special target unit <filename>suspend-then-hibernate.target</filename>.
1893 This command is asynchronous, and will return after the hybrid sleep operation is successfully enqueued.
1894 It will not wait for the sleep/wake-up or hibernate/thaw cycle to complete.</para>
1895 </listitem>
1896 </varlistentry>
1897 </variablelist>
1898 </refsect2>
1899
1900 <refsect2>
1901 <title>Parameter Syntax</title>
1902
1903 <para>Unit commands listed above take either a single unit name (designated as <replaceable>UNIT</replaceable>),
1904 or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>…). In the first case, the
1905 unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"),
1906 systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in
1907 case of commands which operate only on specific unit types. For example,
1908 <programlisting># systemctl start sshd</programlisting> and
1909 <programlisting># systemctl start sshd.service</programlisting>
1910 are equivalent, as are
1911 <programlisting># systemctl isolate default</programlisting>
1912 and
1913 <programlisting># systemctl isolate default.target</programlisting>
1914 Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute)
1915 paths to mount unit names.
1916 <programlisting># systemctl status /dev/sda
1917 # systemctl status /home</programlisting>
1918 are equivalent to:
1919 <programlisting># systemctl status dev-sda.device
1920 # systemctl status home.mount</programlisting>
1921 In the second case, shell-style globs will be matched against the primary names of all units currently in memory;
1922 literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
1923 names always refer to exactly one unit, but globs may match zero units and this is not considered an
1924 error.</para>
1925
1926 <para>Glob patterns use
1927 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
1928 so normal shell-style globbing rules are used, and
1929 <literal>*</literal>, <literal>?</literal>,
1930 <literal>[]</literal> may be used. See
1931 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1932 for more details. The patterns are matched against the primary names of
1933 units currently in memory, and patterns which do not match anything
1934 are silently skipped. For example:
1935 <programlisting># systemctl stop sshd@*.service</programlisting>
1936 will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
1937 in memory are not considered for glob expansion.
1938 </para>
1939
1940 <para>For unit file commands, the specified <replaceable>UNIT</replaceable> should be the name of the unit file
1941 (possibly abbreviated, see above), or the absolute path to the unit file:
1942 <programlisting># systemctl enable foo.service</programlisting>
1943 or
1944 <programlisting># systemctl link /path/to/foo.service</programlisting>
1945 </para>
1946 </refsect2>
1947
1948 </refsect1>
1949
1950 <refsect1>
1951 <title>Exit status</title>
1952
1953 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
1954
1955 <para><command>systemctl</command> uses the return codes defined by LSB, as defined in
1956 <ulink url="http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html">LSB 3.0.0</ulink>.
1957 </para>
1958
1959 <table>
1960 <title>LSB return codes</title>
1961
1962 <tgroup cols='3'>
1963 <thead>
1964 <row>
1965 <entry>Value</entry>
1966 <entry>Description in LSB</entry>
1967 <entry>Use in systemd</entry>
1968 </row>
1969 </thead>
1970 <tbody>
1971 <row>
1972 <entry><constant>0</constant></entry>
1973 <entry>"program is running or service is OK"</entry>
1974 <entry>unit is active</entry>
1975 </row>
1976 <row>
1977 <entry><constant>1</constant></entry>
1978 <entry>"program is dead and <filename>/var/run</filename> pid file exists"</entry>
1979 <entry>unit <emphasis>not</emphasis> failed (used by <command>is-failed</command>)</entry>
1980 </row>
1981 <row>
1982 <entry><constant>2</constant></entry>
1983 <entry>"program is dead and <filename>/var/lock</filename> lock file exists"</entry>
1984 <entry>unused</entry>
1985 </row>
1986 <row>
1987 <entry><constant>3</constant></entry>
1988 <entry>"program is not running"</entry>
1989 <entry>unit is not active</entry>
1990 </row>
1991 <row>
1992 <entry><constant>4</constant></entry>
1993 <entry>"program or service status is unknown"</entry>
1994 <entry>no such unit</entry>
1995 </row>
1996 </tbody>
1997 </tgroup>
1998 </table>
1999
2000 <para>The mapping of LSB service states to systemd unit states is imperfect, so it is better to
2001 not rely on those return values but to look for specific unit states and substates instead.
2002 </para>
2003 </refsect1>
2004
2005 <refsect1>
2006 <title>Environment</title>
2007
2008 <variablelist class='environment-variables'>
2009 <varlistentry>
2010 <term><varname>$SYSTEMD_EDITOR</varname></term>
2011
2012 <listitem><para>Editor to use when editing units; overrides
2013 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
2014 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
2015 <varname>$VISUAL</varname> are present or if it is set to an empty
2016 string or if their execution failed, systemctl will try to execute well
2017 known editors in this order:
2018 <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2019 <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2020 <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2021 <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
2022 </para></listitem>
2023 </varlistentry>
2024 </variablelist>
2025 <xi:include href="less-variables.xml" xpointer="pager"/>
2026 <xi:include href="less-variables.xml" xpointer="less"/>
2027 <xi:include href="less-variables.xml" xpointer="lesscharset"/>
2028 </refsect1>
2029
2030 <refsect1>
2031 <title>See Also</title>
2032 <para>
2033 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2034 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2035 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2036 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2037 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2038 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2039 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
2040 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2041 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2042 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
2043 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
2044 </para>
2045 </refsect1>
2046
2047 </refentry>