Startup management-startup process-run level (seven levels, runlevel, init)

1. Run level

Run level meaning
0 Shutdown
1 Single user mode, can be imagined as the safe mode of Windows, mainly used for system repair
2 Incomplete command line mode, without NFS service
3 Complete command line mode, which is the standard character interface mode
4 System reserved (unused)
5 Graphics mode
6 Restart

explain:

(1) Single user mode:

  • It is not a real Linux safe mode. This is similar to the safe mode in Windows. Only the most basic services are started, and the remaining services are not needed. They are mainly used for system repair. In the Windows safe mode, only the most basic tools and programs are started, and other redundant ones are not started.
  • This is only called single-user mode in Linux, because Linux has its own real CD-ROM boot safe mode. Although this is only the most basic program to start, the program still starts from the hard disk of the system, and it still can’t do some functions. , Still can not be repaired. But in the safe mode of the CD, he starts the system from the CD, which has nothing to do with the hard disk system. In theory, any errors can be repaired.

(2) Incomplete command line mode: NFS is a service for file sharing between Linux and Unix, which can be seen as a lame command line.

(3) Complete command line mode: It is the command mode we use, pure character interface, and enter the third level.
 

2. Run level commands

Command: runlevel
Function: View the run level command

Command: init 运行级别
Function: Change the run level command

hint:
(1) Query the current level. The runlevelresult is N 3. N represents the level before entering the third level. Null means empty, which means that the boot directly enters the third level. The result is that 5 3 represents the entry from level 5 to level 3, which is equivalent to entering the character interface from the graphical interface.
(2) In addition to shutdown, init 0 can also shut down, but this command will not save running services when shutting down, so it is not necessarily safe. Init 6 is to restart. If a graphical interface is installed, init 5 should enter the graphical interface.

3. System default run level

If the computer is equipped with both a character interface and a graphical interface, which one should be entered first after booting? ? ? Can I manually control which interface I enter when I boot? ? Of course, you only need to modify the configuration file /etc/inittab to define which level to enter after booting.

command:vim /etc/inittab

  • (1) Open the configuration file vim /etc/inittab
     
    Insert picture description here

Tips:
(1) In the system before centos 6.0, the content of this configuration file is far more complicated than it is now. What is written is the most important configuration file for system startup. The system startup process depends entirely on this configuration file. Definition. Init is the first process started by the system, and its process number is always 1. This /etc/inittab file is mainly used to configure the init process, but in systems after centos 6.0, the optimized startup sequence has been updated and the optimized startup has been updated. Process, so this configuration file is only responsible for defining the default startup level. All other functions are defined and hidden in these comments. That is to say, the corresponding configuration files are transferred. All the functions originally are in this file. Now they are separated. Saved, weakened the function of the init process.
(2) The centos7 file is no longer useful, it is configured with systemctl

Guess you like

Origin blog.csdn.net/weixin_46818279/article/details/108029224