Linux 101 : Systemd (Systemctl)


Systemd is an init system, it initializes and manages services on the system, it also handles how services start at boot time.

We can use it to stop, start or restart service after modifying the configuration file of a service for example.

Systemctl is the interface we use to manage systemd.

Units:

Systemd manages "units", they are a representation of the different system component (socket, daemons,...) that systemd handles and manage.

Listing all the units:

Listing the "service" units type:

Enabling a service:

Enables services to start at boot time:

service_name could be sshd.service or docker.service for example.

Disabling a service:

Disabled services are not started at boot time.

Stopping and starting a service:

Restart a service after changing the configuration file:

Status of a service, running, stopped?

Listing failed services at boot time:

Is the service "enabled"?:

Enabled services start at boot time.


Rebooting and shutting down the machine:

Journaling with Systemd:


Shows logs of the system boot. 

Shows logs of a specific service "service_name".

Masking and unmasking services:

We can't start masked services either manually or automatically until they are unmasked.

We will need to unmask them gain to be able to start them.


 

Comments

Leave as a comment:

Archive