Search notes:

systemctl

systemctl controls the systemd system and service manager.
systemctl must not to be confused with sysctl.
systemctl [OPTIONS…] COMMAND [UNIT…]

Commands

Unit Commands

Unit commands are used for introspection and modification.
In unit commands (and unit file commands?), UNIT specifies a (single) unit name while PATTERN… specifies multiple units.

Unit name suffix

The type of the unit is separated from the unit name by a dot. If the type is omitted, systemctl appends a suitable suffix (typically .service but type specific suffixes are possible).
So, the following four commands are equivalent:
systemctl start sshd
systemctl start sshd.service
These two are also equivalent:
systemctl isolate default
systemctl isolate default.target
Absolute path names are converted to device unit names or mount unit names
These two commands are equivalent
systemctl status /dev/sda
systemctl status dev-sda.device

List of commands

list-units [PATTERN…] Compare with list-unit-files
list-automounts [PATTERN…]
list-sockets [PATTERN…]
list-timers [PATTERN…]
is-active PATTERN…
is-failed PATTERN…
status [PATTERN…|PID…]]
show [PATTERN…|JOB…] Show properties of units, jobs or the manager itself. Compare with set-property
cat PATTERN…
help PATTERN…|PID…
list-dependencies [UNIT…]
start PATTERN… Start the specified units (i. e. activate them)
stop PATTERN…
reload PATTERN…
restart PATTERN…
try-restart PATTERN…
reload-or-restart PATTERN…
try-reload-or-restart PATTERN…
isolate UNIT
kill PATTERN…
clean PATTERN…
freeze PATTERN…
thaw PATTERN…
set-property UNIT PROPERTY=VALUE… Compare with show and the -p (or --property) options.
bind UNIT PATH [PATH]
mount-image UNIT IMAGE [PATH [PARTITION_NAME:MOUNT_OPTIONS]]
service-log-level SERVICE [LEVEL]
service-log-target SERVICE [TARGET]
reset-failed [PATTERN…]

Unit File Commands

list-unit-files [PATTERN…] Compare with list-units
enable UNIT…, enable PATH… Enables the specified units by creating symlinks as specified in the [Install] sections of the corresponding unit files.
disable UNIT… Disables the specified unit.
reenable UNIT…
preset UNIT…
preset-all
is-enabled UNIT… Check if a unit is enabled.
mask UNIT…
unmask UNIT…
link PATH…
revert UNIT…
add-wants TARGET UNIT…, add-requires TARGET UNIT…
edit UNIT…
get-default Returns the target (unit name default.target) into which the system is booted by default. (Apparently, if the Kernel command line contains single (and also other words?), the default can be or is overrwritten)
set-default TARGET

Machine Commands

There is only one machine command: list-machines [PATTERN…].

Job Commands

list-jobs [PATTERN…]
cancel JOB…

Environment Commands

systemd supports an environment block that is passed to processes the manager spawns. The names of the variables can contain ASCII letters, digits, and the underscore character. Variable names cannot be empty or start with a digit. In variable values, most characters are allowed, but the whole sequence must be valid UTF-8. (Note that control characters like newline (NL), tab (TAB), or the escape character (ESC), are valid ASCII and thus valid UTF-8). The total length of the environment block is limited to _SC_ARG_MAX value defined by sysconf(3).
show-environment
set-environment VARIABLE=VALUE…
unset-environment VARIABLE…
import-environment VARIABLE…

Manager State Commands

daemon-reload
daemon-reexec
log-level [LEVEL]
log-target [TARGET]
service-watchdogs [yes|no]

System Commands

is-system-running
default
rescue
emergency
halt
poweroff
reboot
kexec
exit [EXIT_CODE]
switch-root ROOT [INIT]
suspend Triggers the target unit system.target in order to suspends the system.
hibernate
hybrid-sleep
suspend-then-hibernate

Options

-t --type= Restricts command to the indicated (comma separated list) unit type.
--state=
-p --property= See also the set-property and show commands.
-P
-a --all
-r --recursive
--reverse
--after
--before
--with-dependencies
-l --full
--value
--show-types
--job-mode=
-T --show-transaction
--fail
--check-inhibitors=
-i Shortcut for --check-inhibitors=no.
--dry-run
-q --quiet
--no-warn
--no-block
--wait
--user
--system
--failed
--no-wall
--global
--no-reload
--no-ask-password
--kill-whom=
-s --signal=
--what=
-f --force
--message=
--now
--root=
--image=image
--runtime
--preset-mode=
-n --lines=
-o --output=
--firmware-setup
--boot-loader-menu=timeout
--boot-loader-entry=ID
--reboot-argument=
--plain
--timestamp=
--mkdir
--marked
--read-only
-H --host=
-M --machine=
--no-pager
--legend=BOOL
-h --help
--version

name.service files

systemctl reads name.service files. These files define how and when services (daemons) should be started.
These service files are located in /usr/lib/systemd/system. (Possibly also in /run/systemd/system or /etc/systemd/system).

Enabling a service

systemctl enable avahi-daemon.service

Starting a service

systemctl start avahi-daemon.service

Showing the status

Without arguments, systemctl status shows the system status.

See also

Shell commands

Index