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