« Back to Cheat sheets for Linux

systemd cheat sheet

Basics

Systemd is a system and service manager. It is replacing older init systems and running Process ID (PID) 1, managed by the kernel itself.

Want to learn more? Have a look at the systemd section.

Systemd information

CommandPerformed action
systemctl get-defaultShow default target (like run level)
systemctl list-automountsShow automounts
systemctl list-dependenciesShow dependencies of an unit or default target
systemctl list-jobsView active jobs
systemctl list-socketsList sockets and what it activates
systemctl list-timersList timers (scheduled tasks, similar to cronjobs)
systemctl list-unit-filesShow unit files and state
systemctl list-unitsShow if units are loaded/active

Basics for services

Stop and start

CommandPerformed action
systemctl stopStop running service
systemctl startStart service
systemctl restartRestart running service
systemctl reloadReload config files for service

Status and unit changes

CommandPerformed action
systemctl daemon-reloadReload changed unit files
systemctl statusShow status of service
systemctl state=failed (or --failed)Show failed services
systemctl reset-failedResets unit(s) with failed state
systemctl enableEnable service or unit and allow start on boot
systemctl disableDisable service or unit, don’t start at boot
systemctl maskFully disable a unit
systemctl unmaskReactivate unit again after being masked

Configuration

CommandPerformed action
systemctl catShow unit file details
systemctl showShow properties
systemctl editCreate configuration as drop in unit (extension to primary config)
systemctl edit --fullEdit primary unit file for service

» Mastering the tool: systemctl

systemctl cheat sheet

Journal

Instead of a log files, systemd stores logging information in journals.

Long optionShort optionWhat the option does
--follow-fTrack changes, like tail -f
--output=-oDefine what output format should be used for journal entries
--reverse-rReverse output, newest on top
--since-SLimit the data to a specific period

» Mastering the tool: journalctl

journalctl cheat sheet

System state

The options to change the system state are:

  • systemctl reboot
  • systemctl poweroff
  • systemctl suspend
  • systemctl hibernate

Relevant articles using systemd command

The following articles include an example on how to use systemd and might be worth further exploring.

    Liked this cheat sheet? There are more!

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon