Skip to main content

systemd

systemd is a suit of basic building blocks for a linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.

Basic systemctl usage

The main command used to introspect and control systemd is systemctl. Some of its uses are examinig the system state and managing the system and services.

Using units

Units commonly include, but are not limited to, services (.service), mount points (.mount), devices (.device) and sockets (.socket). When using systemctl, you generally have to specify the complete name of the unit file, including suffix, for example sshd.socket. There are a few short forms when specifying the unit int the following systemctl commands:

  • If you do not specify the suffix, systemctl will assume .service
  • Mount points will automatically be translated into the appropriate .mount unit. For example /home is equivalent to home.mount
  • Similar to mount points, devices are automatically translated into the appropriate .device unit. Therefore specifying /dev/sda2 is equivalent to dev-sda2.device
ActionCommandNote
Show system statussystemctl status
List running unitssystemctl or systemctl list-units
List failing unitssystemctl --failed
List installed unit filessystemctl list-unit-files
Show process status for a PIDsystemctl status pidcgroup slice, memory and parent
Show a manual page associated with a unitsystemctl help unitas supported by the unit
Status of a unitsystemctl status unitincluding whether it is running or not
Check whether a unit is enabledsystemctl is-enabled unit
Start a unit immediatelysystemctl start unit
Stop a unit immediatelysystemctl stop unit
Restart a unitsystemctl restart unit
Reload a unit and its configurationsystemctl reload unit
Enable a unit to start auatomatically at bootsystemctl enable unit
Enable a unit to start auatomatically at boot and start it immediatelysystemctl enable --now unit
Disable a unit to no longer to start at bootsystemctl disable unit
Reenable a unitsystemctl reenable uniti.e. disable and enable anew