Linux 101 : Systemd, Systemctl, Unit and Unit files
Systemd initializes the Linux system - processes, mount,.. -, after the boot process has finished.
It also the first process that starts with a PID=1.
The systemd units control services, mounts, swap spaces, sockets, ...
A unit file is a file that contains different parameters and data about the units - services, devices, mount points, ... -
The services could also have the below states:
Disabled services will not start at boot time, and we would have to start them manually is need be.
Systemd manages the system as units and unit files.
The systemd units control services, mounts, swap spaces, sockets, ...
A unit file is a file that contains different parameters and data about the units - services, devices, mount points, ... -
Systemd also handles the targets - equivalent to runlevels -, which are a combination of units "working together" to produce a certain environment, for example the "multi-user.target" environment ,or the "graphical.target" environment.
To know the default target that our system is running, we could use the below command:
To switch to a different target, for example the "multi-user.target", we use the below command:
To list all the unit-files for the services, we use the below command:
To list all the services, we use:
To list the "running" services, we use the below command:
The type could also be : socket, mount, swap, target, ...
The services could also have the below states:
- enabled : enabled services start automatically.
- disabled : are not taken into account during boot time.
- static : can't be enabled or disabled
- masked : masked services can't be started.
directories.
Disabled services will not start at boot time, and we would have to start them manually is need be.
We can disable a service using the below command:
Masked services can't be started. We could mask a service using he below command:
Comments