The first process of the system, with a process ID of 1.
However, when we want to display detailed information, the result will be different.
In fact, these two processes are the same, because init points to systemd.
init is the earliest initialization process in Unix. Since systemd has replaced init,
for compatibility, /sbin/init is usually a symbolic link pointing to systemd.
The naming convention of adding d after the name is the naming convention of Unix daemon processes, and System D is a term,
which means the ability to think quickly and solve problems. systemd was born in 2010, and before that, SysVinit was used.
5 corresponds to graphical.target, and N means the last runlevel was No.
The default target for Ubuntu on Alibaba Cloud is graphical.target,
which is for users to manage the operating system using a graphical interface (VNC),
if not needed, the target can be changed to multi-user.target.
rc stands for run commands, and .d stands for directory, the purpose is to avoid naming conflicts.
This directory contains processes started under a specific runlevel, for example, runlevel 5 corresponds to /etc/rc5.d.
Although systemd is now used, for compatibility, these directories and scripts are still retained.
Unit files are the configuration files of systemd, used to define and manage system services, devices, mount points, sockets, and other system resources.
Each unit file describes how systemd starts, stops, and monitors related resources.
From the above, we can see that a target is a type of unit file. Unlike general unit files, it represents the current running state of the system,
the target defines which processes and services need to be started under that state, so a target can contain multiple unit files.
You can view the current target of the system with the following command.
Target files are usually stored in the /usr/lib/systemd/system/ or /etc/systemd/system/ directory.
Each target file contains information about the dependencies and startup order of that target.
Let’s take a look at the content of the multi-user.target file.
The following two directories contain the content needed for the multi-user.target state.
/etc is user-defined configuration, /lib is system default configuration.
User-defined configuration: higher priority, systemd will execute the same service first.
System default configuration: when the system or software package is updated, it will be updated accordingly.