The runlevel is the functional level that the operating system is currently running. The levels are from 0 to 6 and have different functions. These levels are defined in the/ect/inittab file. This file is init
The main file that the program looks for, the first service to run is those files that are placed in the/ETC/RC.D directory.
There are 7 operating levels under Linux:
0
System shutdown mode, the system default operation level cannot be set to 0, otherwise it will not start normally, the machine shuts down.
1
Single user mode, root privilege, for system maintenance, prohibit remote login, just like Windows Safe Mode login.
2
Multi-user mode with no NFS network support.
3
Full multi-user text mode with NFS, login to console command line mode.
4
The system is unused, reserved for general use, and in some special cases it can be used to do something. For example, when the laptop battery is exhausted, you can switch to this mode to do some
Set up.
5
Graphical mode, enter GUI mode after login, X
Window System.
6
Restart mode, the default run level cannot be set to 6, otherwise it will not start normally. Run Init
6 The machine will restart.
Operating level principle:
1. There are many server scripts under directory/ETC/RC.D/INIT.D, commonly referred to as services (service)
2. Under/ETC/RC.D There are 7 directories named RCN.D, corresponding to the 7 operating levels of the system
3.RCN.D Directory is a number of symbolic links (i.e., soft links) files, which point to the/ETC/RC.D/INIT.D directory of service script files, naming rules for k+nn+
The name of the service or s+nn+, where nn is a two-digit Arabic numeral.
4. When the system starts, it enters the corresponding RCN.D directory according to the specified RunLevel and retrieves the linked files in the directory according to the file name order: For files starting with K, the system terminates
the corresponding service;
For files beginning with S, the system will start the corresponding service
5. Viewing runlevel: RunLevel
#表示当前系统运行在level
3 mode
6. Go to other operating levels using: Init
N, init 5 login GUI mode if init 3 enters terminal mode
#表示运行级别由3进入到5
#再次输入init 3, the run level is 5 back to 3
7. Another init 0 is shutdown, init 6 Restarts the system
Note: When you enter init 0, the system shuts down, and when you enter Init 6, the system restarts automatically. Be very careful with these two commands!
The standard Linux run level is 3 or 5, and if it is 3, the system is in multi-user state, and if it is 5, it is running the X Window System.
Different operational levels have different uses, and should be set according to their own different situations.
For example, if you lose the root password, you can set the machine to boot into a single-user state.
1. Enter e in the Grub interface after startup;
2. Cursor Select kernel line, enter e again;
3. At the end add "Space single", enter;
4. Press the B key to enter the single user mode;
5. By passwd
Root command, change the root password;
Linux RunLevel [go from network]