Article Title: Linux operating system running level. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The Linux operating system has to go through several different stages from the start to the completion of the start. These stages are called runlevel. Similarly, when the Linux operating system is shut down, it has to go through several different runlevels, next we will prepare to introduce runlevel in detail and show you some tips to avoid unnecessary Restart for your linux system. Runlevel can be regarded as the system status and image. You can think of runlevel as Normal, safemode, and Command promptonly in Microsoft's windows operating system. To access each runlevel, you need to start or close a series of services. These services are stored in the/etc/rc. d/rc? directory as initialization scripts ?. D/or/etc/rc ?. Under d (? Indicates the serial number of runlevel ).
In most linux releases, there are usually eight runlevels
Runlevel System State
0 Halt the system
1 Single user mode
2 Basic multi user mode
3 Multi user mode
5 Multi user mode with GUI
6 Reboot the system
S, s Single user mode
* *** The following is an excerpt from RedHat Enterprise Linux 5 (/etc/inittab)
# Default runlevel. The runlevels used by RHS are:
#0-halt (Do NOT set initdefault to this)
#1-Single user mode
#2-Multiuser, without NFS (The same as 3, if you do not have networking)
#3-Full multiuser mode
#4-unused
#5-X11
#6-reboot (Do NOT set initdefault to this)
In most Desktop linux systems, the default runlevel is 5, while in most server versions, the default runlevel is 3, and in most server versions, the default runlevel is 3, runlevel 1 and 2 are rarely used in addition to debugging. runlevel s and S are not directly used by users, but used to prepare for Single user mode.
The linux operating mode has the following advantages over the windows Startup Mode: You can use it when the system is idle. the init tool switches the runlevel you are currently using. In addition, when you shut down or start the linux system, you can switch your runlevel without knowing it. The system shutdown process needs to call runlevel (0 or 6) to close all running processes.
Display current running mode
When you get started, you may be curious about the previous and current running modes. The runlevel command can be used to display the information:
$/Sbin/runlevel
3 5
The runlevel command output indicates that the initial running mode is 3, and the current running mode is 5.
Switch Operation Mode
Use the telinit command (root User) to switch the running mode ):
$/Sbin/telinit
Generally, the purpose of switching the running mode is to restart some application processes, such as XFree86. Switching the running mode from 5 to 3 will terminate XFree86 and all processes related to it, then switch the running mode to 5, and XFree86 can be started very cleanly. Before doing this, make sure that all the work in XFree86 has been saved. Use the root user:
$/Sbin/telinit 3
$/Sbin/telinit 5
After you type a command, your screen may display information about the service start or stop.
[1] [2] Next page