systemd cheat sheet

Services overview and unit files

# Show running units

# Show status of OS
systemctl status

# List all units
systemctl list-units

# Display failed units:
systemctl --failed

The available unit files can be seen in /usr/lib/systemd/system/ and /etc/systemd/system/

Start / stop

systemctl start unit
# samples
systemctl start apache2.service

# stop
systemctl stop apache2.service

# restart
systemctl restart unit

# reload
systemctl reload unit

# Check whether a unit is already enabled or not:
systemctl is-enabled unit

# Show the status of a unit, including whether it is running or not:
systemctl status unit

Checking status

By default it should be possible to view the output of every unit using journal – journalctl

# Display logs of unit
journalctl -u unit

Enable / disable service

# Enable a unit to be started on bootup:
systemctl enable unit

# Disable a unit to not start during bootup:
systemctl disable unit

# Mask a unit to make it impossible to start it:
systemctl mask unit

# Unmask a unit:
systemctl unmask unit

Power management

# Reboot
systemctl reboot

# Shut down and power-off the system:
systemctl poweroff

# Suspend the system:
systemctl suspend

# Put the system into hibernation:
systemctl hibernate

# Put the system into hybrid-sleep state (or suspend-to-both):
systemctl hybrid-sleep

Modifying system

  • /usr/lib/systemd/system/: units provided by installed packages
  • /etc/systemd/system/: units installed by the system administrator

When you modify the unit file, you always need to run:

systemctl daemon-reload

See for more information

No Comments

You can leave the first : )

Leave a Reply

Your email address will not be published. Required fields are marked *