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 units, mount 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 display the running "services", we use the below command:
We might come across the term "unit-files". The "unit-files" simply represent the configuration files of the units.
The targets replace the old concept of "run levels".
Targets represents a group of specific units that are started together.
The "default" target is the target that starts when we boot the system, we could display it using the below command:
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.