Linux 101 : A quick dive into Systemd - Targets, Units, Boot performance, ... -



Within systemd the units represent the system resources.
Services represent one of these units that usually has the name "xxxxxx.service". 

Some of the other units include the device units, target unitsmount units, socket units, ...
To see all the service units on a system, we could use the below command:


To see all the units - regardless of its type -, we could use the below command:


To see all the running units, we use the below command:


To display the running "services", we use the below command:


Remark:

We might come across the term "unit-files". The "unit-files" simply represent the configuration files of the units.

Targets

The targets replace the old concept of "run levels".
Targets represents a group of specific units that are started together.

To display the targets, we can use the following command:


The "default" target is the target that starts when we boot the system, we could display it using the below command:


We see that the "graphical.target" is the default target.

Below are a some of the "predefined" targets:

  • poweroff.target : to shutdown a system.
  • multiuser.target : to launch a non-graphical multiuser system.
  • graphical.target to start a graphical multiuser system.
  • reboot.target : to reboot a system.
Each one of these targets groups together a specific units and their dependencies.

Changing the system target "runlevel":

To change the target, we could use the below command:


Then, we reboot the system

We could also do it using the below command, which doesn't necessitate a reboot:


Systemd could also help us gauge the performance of a system. 
By running the below command, we could check the speed of the booting process:


Using the "blame" parameter, we can check which services are slowing down the boot process:


It displays all the running units in a descending order according to the time it took them to start.

Comments

Leave as a comment:

Archive