systemd, init - systemd system and service manager

systemd is a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that brings up and maintains userspace services. Separate instances are started for logged-in users to start their services.

systemd is usually not invoked directly by the user, but is installed as the /sbin/init symlink and started during early boot. The user manager instances are started automatically through the user@.service(5) service.

systemd is a collection of programs and libraries

  • init

  • systemctl

  • journalctl

  • process management

  • networkd (network management)

  • logind (login management)

  • journald (logs)


PID 1: it initializes the system

  • has power over other processes

    • if a process is orphaned because it parent process is terminated, the process will be re-parented by init

    • kills zombie processes

  • systemd is init but also handles system state and services


A unit is any entity managed by systemd.

  • Service

  • Socket

  • Device

  • Mountpoint or Automount point

  • Swap File

  • Partition

  • startup target

  • watched filesystem path

  • group of externally created processes

unit file location Description
/lib/systemd/system/ standard systemd unit files
/usr/lib/systemd/system/ locally install packages (dnf)
/run/systemd/system/ transient
/etc/systemd/system/ custom unit files

vim /etc/systemd/system/tomcat.service

Description=Tomcat 9 servlet container
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
  • this unit should only be brought up after we have networking

  • Type=forking: the main process is going to start and bind to a port, forks, and creates child processes

  • ExecStart: command for starting the service

  • ExecStop: command for stopping the service

  • who wants this process to run


May be used to introspect and control the state of the systemd system and service manager.

systemctl enable

systemctl disable

systemctl status

sudo systemctl start 

sudo systemctl stop

sudo systemctl restart

systemctl daemon-reload

systemctl list-units --type=service

systemctl list-unit-files


Query the systemd journal.

sudo journalctl -u tomcat2.service

slash “/” goes into search

-f : follow the log entries

–since “2020-12-28 10:24:00”


A daemon is a background, non-interactive program. It is detached from the keyboard and display of any interactive user. The word daemon for denoting a background program is from the Unix culture; it is not universal.

A service is a program which responds to requests from other programs over some inter-process communication mechanism (usually over a network). A service is what a server provides. For example, the NFS port mapping service is provided as a separate portmap service, which is implemented as the portmapd daemon.

A service doesn’t have to be a daemon, but usually is. A user application with a GUI could have a service built into it: for instance, a file-sharing application.


manage relationships between units

  • figures out dependencies for you

  • last target it hits after boot

  • before the network comes up


Linux systemd - tutoriaLinux

Daemon vs Service