The running level is the current running function level of the operating system. Levels are from 0 to 6, with different functions. These levels are defined in the ectinittab file. This file is the main file searched by the init program. The first service to run is the files stored in the etcrcd directory. The running level is the current running function level of the operating system. Levels are from 0 to 6, with different functions. These levels are defined in the/ect/inittab file. This file is init
The main files that the program looks for are the files that are first run in the/etc/rc. d Directory.
There are 7 running levels in Linux:
0: system shutdown mode. the default running level cannot be set to 0. Otherwise, the system cannot start normally and the machine is disabled.
1. single-user mode, root permission, used for system maintenance, remote login prohibited, just like safe login in Windows.
2-user mode, not supported by NFS.
3. complete multi-user text mode with NFS. log on to the console and go to command line mode.
4. the system is not used and generally does not need to be retained. in some special cases, you can use it to do something. For example, you can switch to this mode when the battery of your laptop is exhausted.
.
5. in graphical mode, log on to the graphical GUI mode and use the X Window System.
6. restart mode. the default running level cannot be set to 6. Otherwise, the instance cannot be started normally. If you run init 6, the system restarts.
Running level principle:
1. there are many server script programs in the directory/etc/rc. d/init. d, which are generally called services)
2. there are 7 directories named rcN. d under/etc/rc. d, corresponding to 7 running levels of the system
3. rcN. the d directory contains some symbolic links (soft links), all of which point to/etc/rc. d/init. the service script file in the d Directory. the naming rule is K + nn + server.
Service name or S + nn + service name, where nn is two Arabic numerals.
4. when the system starts, it enters the corresponding rcN according to the specified running level. d directory, and search the linked files under the Directory in order of file names: for files starting with K, the system will terminate
The corresponding server. for files starting with "S", the system starts the corresponding service.
5. run runlevel
# Indicates that the current system runs in level 3 mode
6. for other running levels, use init N. If init 3 is used, enter terminal mode. if init 5 is used, log on to the GUI mode.
# Indicates that the running level is changed from 3 to 5.
# Input init 3 again, and the running level will return from 5 to 3
7. In addition, init0 is shutdown, and init 6 is used to restart the system.
Note: If init 0 is input, the system will shut down. if init 6 is input, the system will automatically restart. These two commands must be very careful!
The standard Linux operating level is 3 or 5. if it is 3, the system is in the multi-user state; if it is 5, the X Window System is running.
Different running levels have different functions and should be set according to different situations.
For example, if the root password is lost, you can set the machine startup status to a single user.
1. enter e on the GRUB interface after startup;
2. select the line of the kernel and input e again;
3. add "space single" at the end and press enter;
4. press the B key to enter the single-user mode;
5. use the passwd root command to change the root password;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service