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