systemctl is a central part of your experience with systemd

  • Un-official documentation for the systemctl utility in the systemd project.
  • This website is not checked for accuracy. Refer to the official man pages for up-to-date information.

clean PATTERN...

Action Removes everything from directories configured for the specified unit. systemd.timer units clear timestamp data when Persistent= is supplied. Example command systemctl clean dirty.service Options --what Example Clean all directories systemctl clean --what=all badstate.service Clean the log directory systemctl clean --what=logs badlogs.service Options configuration state cache logs runtime all Default paths Directory Below path for system units Below path for user units Environment variable set RuntimeDirectory= /run/ $XDG_RUNTIME_DIR $RUNTIME_DIRECTORY StateDirectory= /var/lib/ $XDG_CONFIG_HOME $STATE_DIRECTORY CacheDirectory= /var/cache/ $XDG_CACHE_HOME $CACHE_DIRECTORY LogsDirectory= /var/log/ $XDG_CONFIG_HOME/log/ $LOGS_DIRECTORY ConfigurationDirectory= /etc/ $XDG_CONFIG_HOME $CONFIGURATION_DIRECTORY

August 23, 2022 · 1 min

disable UNIT...

Action Removes all systemd-related symbolic links configured for the unit file, including those manually created. Disables all units listed in the Also= section. Example command systemctl disable enabled.service Options --now Purpose Stop the unit immediately after the linkage to start it is removed. Example systemctl disable --now runningandenabled.service --system Purpose Disables the unit for the system Example systemctl disable --system system.service --user Purpose Disables the unit for the currently logged in user...

August 22, 2022 · 1 min

enable UNIT..., enable PATH...

Action Installs a symbolic link as specified in the Install section of the unit file. Reloads the configuration in a manner equivalent to running the command systemctl daemon-reload. Options --now Purpose Start the service after it’s enabled. Example systemctl enable --now akings.service --system Purpose Enables the unit for the system Example systemctl enable --system system.service --user Purpose Enables the unit for the currently logged in user Example systemctl enable --user user....

August 22, 2022 · 1 min

list-unit-files [PATTERN...]

Action Prints a list of unit files installed on the system, and their state as reported by is-enabled. Note This command will show template units, which list-units does not.

August 22, 2022 · 1 min

preset UNIT...

Action Sets the enable/disable status for the unit file, with the defaults found in the preset policy files. Options --preset-mode=<mode> Purpose Override the preset mode. Options full enable-only disable-only Example Set the default preset to enable for any unit. systemctl preset-all --preset-mode=enable-only allgreen.service

August 22, 2022 · 1 min

preset-all

Action Sets the enable/disable status, for unit files with proper linkages, with the defaults found in the preset policy files. Options --preset-mode=<mode> Purpose Override the preset mode. Options full enable-only disable-only Example Set the default preset to enable for any unit. systemctl preset-all --preset-mode=enable-only allgreen.service

August 22, 2022 · 1 min

reenable UNIT...

Action Disables, and then enables the unit.

August 22, 2022 · 1 min

bind UNIT PATH [PATH]

Action Bind-mounts a into the unit’s namespace Supported mount types Directory Normal file A device node AF_UNIX socket A named pipe/FIFO Options --read-only Purpose Mount the bind in a manner where changes cannot be made to the source. Example Bind /dev/null over /etc/issue so that the file will always empty to the unit. systemctl bind --read-only bindable.service /dev/null /etc/issue --mkdir Purpose Create the destination path that the bind will mount to, if not present....

August 21, 2022 · 1 min

cat PATTERN...

Action Prints the contents of a unit as systemd understands it to exist in memory. The source of the file is given proper accredidation in the print-out. Example output % systemctl cat dbus.service # /lib/systemd/system/dbus.service [Unit] Description=D-Bus System Message Bus Documentation=man:dbus-daemon(1) Requires=dbus.socket # Do not stop on shutdown DefaultDependencies=no Wants=sysinit.target After=sysinit.target basic.target [Service] ExecStart=@/usr/bin/dbus-daemon @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig OOMScoreAdjust=-900

August 21, 2022 · 1 min

freeze PATTERN...

Action Cause all processes contained within the unit to be suspended Example command systemctl freeze hot.service

August 21, 2022 · 1 min

help PATTERN...|PID...

Action Opens the manual pages for the supplied command if they are present. When a PID is supplied, the man pages for the unit file are opened.

August 21, 2022 · 1 min

is-active PATTERN...

Returns The high-level activation status of the supplied service Example command systemctl is-active failed.service Example output failed

August 21, 2022 · 1 min

is-failed PATTERN...

Returns The high-level activation status of the supplied service Example command systemctl is-failed running.service Example output active

August 21, 2022 · 1 min

isolate UNIT

Action Starts the unit specified (and dependency chain), and stops everything else Note This command will stop your user interface. You may have to find other virtual consoles to see any output

August 21, 2022 · 1 min

kill PATTERN...

Action Sends a signal to processes owned by the unit Returns A message if an error occurs Note The process that’s killed can be chosen by using --kill-who=<pid> The signal can be chosen by using --signal=<signal>

August 21, 2022 · 1 min

list-dependencies [UNIT...]

Action Prints a chain of dependencies required for the service to start Options --all Purpose Expand every unit Example systemctl list-dependencies --all --reverse --after --before Example output % systemctl list-dependencies dbus.service dbus.service ● ├─dbus.socket ● ├─system.slice ● └─sysinit.target ● ├─apparmor.service ● ├─dev-hugepages.mount ● ├─dev-mqueue.mount ● ├─keyboard-setup.service ● ├─kmod-static-nodes.service ● ├─plymouth-read-write.service ● ├─plymouth-start.service ● ├─proc-sys-fs-binfmt_misc.automount ● ├─setvtrgb.service ● ├─sys-fs-fuse-connections.mount ● ├─sys-kernel-config.mount ● ├─sys-kernel-debug.mount ● ├─sys-kernel-tracing.mount ○ ├─systemd-ask-password-console.path ○ ├─systemd-binfmt.service ○ ├─systemd-boot-system-token.service ● ├─systemd-journal-flush....

August 21, 2022 · 1 min

list-sockets [PATTERN...]

Returns Sockets currently in memory. Run with –all to show loaded, but inactive sockets too Output format LISTEN, UNIT, ACTIVATES Example output LISTEN UNIT ACTIVATES /dev/rfkill systemd-rfkill.socket systemd-rfkill.service /run/acpid.socket acpid.socket acpid.service /run/avahi-daemon/socket favahi-daemon.socket avahi-daemon.service /run/cups/cups.sock cups.socket cups.service /run/dbus/system_bus_socket dbus.socket dbus.service /run/docker.sock docker.socket docker.service /run/initctl systemd-initctl.socket systemd-initctl.service /run/rpcbind.sock rpcbind.socket rpcbind.service /run/snapd-snap.socket snapd.socket snapd.service /run/snapd.socket snapd.socket snapd.service /run/systemd/fsck.progress systemd-fsckd.socket systemd-fsckd.service /run/systemd/journal/dev-log systemd-journald-dev-log.socket systemd-journald.service /run/systemd/journal/socket systemd-journald.socket systemd-journald.service /run/systemd/journal/stdout systemd-journald.socket systemd-journald.service /run/systemd/journal/syslog syslog.socket rsyslog.service /run/udev/control systemd-udevd-control....

August 21, 2022 · 1 min

list-timers [PATTERN...]

Action Print a list of timers that are currently active in memory. Output format Name Description NEXT Next time the timer will run LEFT Time left until next run LAST Last time timer ran PASSED Last time timer passed ran successfully UNIT Unit file for timer ACTIVATES Service file timer activates Example output NEXT LEFT LAST PASSED UNIT ACTIVATES Sun 2022-08-21 19:33:22 EDT 2min 59s left Sun 2022-08-21 18:30:34 EDT 59min ago anacron....

August 21, 2022 · 2 min

list-units [PATTERN...]

Returns Units currently in memory. Run with –all to show all units, including dead/empty ones Output format Name Description UNIT The unit file LOAD Unit load state ACTIVE High-level unit activation state SUB Low-level unit activation state DESCRIPTION Unit description Example output UNIT LOAD ACTIVE SUB DESCRIPTION proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point sys-bus-pci-drivers-nvidia.device loaded active plugged /sys/bus/pci/drivers/nvidia sys-devices-pci0000:00-0000:00:01.0-0000:01:00.1-sound-card1-controlC1.device loaded active plugged /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/controlC1 sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d7-1\x2d7.1-1\x2d7.1.2-1\x2d7.1.2:1.0-sound-card2-controlC2.device loaded active plugged G935_Gaming_Headset sys-devices-pci0000:00-0000:00:1b....

August 21, 2022 · 2 min

mount-image UNIT IMAGE [PATH [PARTITION_NAME:MOUNT_OPTIONS]]

Action Mounts an image from the host into the namespace of the unit Note To make the bind mount read-only, supply --read-only to the command Supplying --mkdir will ensure the path is created before the mount is performed

August 21, 2022 · 1 min

reload PATTERN...

Returns A message if an error occurs Note Does not reload systemd memory configuration if changes are made to the unit file

August 21, 2022 · 1 min

reload-or-restart PATTERN...

Returns A message if an error occurs Note You must run systemctl daemon-reload in order to save the changes for systemd.

August 21, 2022 · 1 min

reset-failed [PATTERN...]

Action Reset the failed state of a unit Note DANGEROUS: If no unit is passed to the command, all unit states are reset

August 21, 2022 · 1 min

restart PATTERN...

Returns A message if an error occurs Note If the units are not running yet, they will only be started

August 21, 2022 · 1 min

service-log-level SERVICE [LEVEL]

Action Sets the log level for a service if supplied. Otherwise, prints out the current level

August 21, 2022 · 1 min

service-log-target SERVICE [TARGET]

Action Sets the log target for a service if supplied. Otherwise, prints out the current level

August 21, 2022 · 1 min

set-property UNIT PROPERTY=VALUE...

Action Set unit properties at runtime, where supported. Some properties are read-only. Example command systemctl set-property memorylimited.service MemoryMax=1G

August 21, 2022 · 1 min

show [PATTERN...|JOB...]

Action Prints a list of Key=Value from properties that the unit, job (by ID), or manager contains. Example command systemctl show dbus.service Example output Type=simple Restart=no NotifyAccess=none RestartUSec=100ms TimeoutStartUSec=1min 30s TimeoutStopUSec=1min 30s TimeoutAbortUSec=1min 30s TimeoutStartFailureMode=terminate TimeoutStopFailureMode=terminate RuntimeMaxUSec=infinity WatchdogUSec=0 WatchdogTimestamp=n/a WatchdogTimestampMonotonic=0 RootDirectoryStartOnly=no RemainAfterExit=no GuessMainPID=yes MainPID=720 ControlPID=0 FileDescriptorStoreMax=0 NFileDescriptorStore=0 StatusErrno=0 Result=success ReloadResult=success CleanResult=success UID=[not set] GID=[not set] NRestarts=0 OOMPolicy=stop ExecMainStartTimestamp=Thu 2022-08-18 16:47:02 EDT ExecMainStartTimestampMonotonic=12881392 ExecMainExitTimestamp=n/a ExecMainExitTimestampMonotonic=0 ExecMainPID=720 ExecMainCode=0 ExecMainStatus=0 ExecStart={ path=/usr/bin/dbus-daemon ; argv[]=@dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only ; ignore_errors=no ; start_time=[Thu 2022-08-18 16:47:02 EDT] ; stop_time=[n/a] ; pid=720 ; code=(null) ; status=0/0 } ExecStartEx={ path=/usr/bin/dbus-daemon ; argv[]=@dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only ; flags= ; start_time=[Thu 2022-08-18 16:47:02 EDT] ; stop_time=[n/a] ; pid=720 ; code=(null) ; status=0/0 } ExecReload={ path=/usr/bin/dbus-send ; argv[]=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org....

August 21, 2022 · 3 min

start PATTERN...

Action Starts the service/timer/mount specified Returns A message if an error occurs

August 21, 2022 · 1 min

status [PATTERN...|PID...]

Returns The status of a unit file Example output ● dbus.service - D-Bus System Message Bus Loaded: loaded (/lib/systemd/system/dbus.service; static) Active: active (running) since Thu 2022-08-18 16:47:02 EDT; 3 days ago TriggeredBy: ● dbus.socket Docs: man:dbus-daemon(1) Main PID: 720 (dbus-daemon) Tasks: 1 (limit: 57666) Memory: 4.0M CPU: 38.983s CGroup: /system.slice/dbus.service └─720 @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only Aug 21 10:13:42 dwd dbus-daemon[720]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1....

August 21, 2022 · 1 min

stop PATTERN...

Action Stops the unit specified Note If an ExecStop= command is specified for the unit, and that command fails, then systemd will terminate any processes under the unit, without presenting an error.

August 21, 2022 · 1 min

thaw PATTERN...

Action Resume processing for all processes contained within the unit Example command systemctl thaw frozen.service

August 21, 2022 · 1 min

try-reload-or-restart PATTERN...

Returns A message if an error occurs Note If the service is not running, and reloading is not possible, this command does nothing.

August 21, 2022 · 1 min

try-restart PATTERN...

Returns A message if an error occurs Note If the units are not running yet, this command does nothing

August 21, 2022 · 1 min