CentOS (4)-Linux Startup level

Source: Internet
Author: User

For most Linux programmers, after entering the Linux system, they usually see a dark interface (development mode), because if the system starts to select the development mode, it will reduce the startup time and optimize the memory. But usually we have just installed the Linux system, and then enter it on the graphic interface (if you want to switch to the development mode, use the shortcut key Ctrl + F2 ), use the shortcut key (Ctrl + F1) to return from the development mode to the graphic interface, or enter the startx command in the command line to switch to the graphic interface.

Note:: If you set the graphic interface to start in startup mode, press the shortcut key (Ctrl + Alt + F2 ~ F7) after entering the terminal interface,
If you enter the command startx, the GUI cannot be returned. However, if you set development mode in startup mode, enter the statx command to return to the graphic interface.

In Linux, you can modify the system startup mode (you must log on as the root user to modify the mode ). The configuration file for modifying the system startup mode is/Etc/inittab.

After switching to the root user, we can modify and view the configuration file by vi/etc/inittab:

[root@xiaoluo ~]:# vi /etc/inittab

After entering the preceding command, we can see the information in the configuration file as follows:

# inittab is only used by upstart for the default runlevel.## ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.## System initialization is started by /etc/init/rcS.conf## Individual runlevels are started by /etc/init/rc.conf## Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf## Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,# with configuration in /etc/sysconfig/init.## For information on how to write upstart event handlers, or how# upstart works, see init(5), init(8), and initctl(8).## Default runlevel. The runlevels used 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)#id:5:initdefault:~                     

We can see the last few lines, and we can see that there are seven default system startup methods in Linux:

0: Shut down (do not set this !)
1: single user (similar to windows operating system security mode)
2: No network service in multi-user status
3: the multi-user status is determined by the network service (usually set to the startup level during development and directly go to the command line interface)
4: The system is not reserved for users (do not set this !)
5: graphic interface (this is the default startup level for linux and directly enters the graphic interface)
6: restart the system (do not set this !)

The following sentence:

Id: 5: initdefault: // sets the default startup level of the system.

It is used to set the default startup level of the system. In Linux, it is set to startup Level 5 by default, that is, Gui startup.

To change to the development mode by default, you only need to change 5 to 3.

For example:

Change id: 5: initdefault: to id: 3: initdefault:

Save and exit. restart the system and enter the reboot command.

Warning do not set the basic startup settings to 0, 4, 6 !!!!!!

At this time, you will find that the interface for entering the Linux system has become the developer mode!

If we only need to develop and deploy projects on Linux, we recommend that you set the system startup mode to the development mode!

[Note]
If a malicious user sets the system startup level to 0, 4, or 6How can we solve this problem?
On the linux Startup interface, we quickly press the "e" button on the disk and enter the grub boot interface (this may vary depending on the Linux version, my CentOS6.4 requires pressing F2 at startup to enter the boot interface,
You can go to the boot page as prompted by the Linux system you have installed at startup ),
Select the second option in this interface, and then press the e button on the keyboard. after entering the modification interface, enter [1] (with a space before 1, when linux is startedSingle user levelStart up (why not set it to 3 or 5 here, because the linux system will first check the startup level set in the/etc/inittab file at startup,If it is set to 5 or 3 at this time, the system still cannot enter, but it can only be set to 1) After the settings are complete, press the [B] button on the keyboard to restart the system and enter the single user level, in this way, we can modify the linux Startup level according to the previous method.

This article mainly records how to set the startup level of the Linux system. More things about the Linux system will be learned later !!!

 

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.