How can I enable Linux to automatically access the graphic interface or prevent it from accessing the graphic interface after it is started?

Source: Internet
Author: User

Transferred from:Http://www.cnblogs.com/helloBreak/archive/2011/09/03/2165897.html

Method 1:

To 3 Characters

[root@15 system]# rm -rf /etc/systemd/system/default.target[root@15 system]# ln -s /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target[root@15 system]# reboot

To 5 graphics

[root@15 system]# rm -rf /etc/systemd/system/default.target[root@15 system]# ln -s /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target[root@15 system]# reboot

Details:

Method 2:

[Switch] How does one enable Linux to automatically access the graphic interface or prevent it from accessing the graphic interface after Linux is started?

15:35:06 | category: Linux | font size subscription

How can I enable Linux to automatically access the graphic interface or prevent it from accessing the graphic interface after it is started?

A. Enter the graphic interface: select the graphic startup mode during installation or change the ID: X: initdefault: of/etc/inittab to ID: 5: initdefault :.

B. Do not enter the graphic interface: select the text startup mode during installation or change the ID: X: initdefault: of/etc/inittab to ID: 3: initdefault :.

* What does inittab do?

After the kernel is up, the first process -- init will be generated, which is actually executed by/sbin/init. Init performs system initialization Based on the/etc/inittab script, such as setting the keyboard, Font, loading module, and network.

Each line of the/etc/inittab file contains four fields:

ID: runlevels: Action: Process

Runlevel is the running mode, usually 0-6. Mode 0 is halt, mode 6 is reboot, Mode 1 is a single user, mode 2/3 is a multi-user, and mode 5 is run xdm to log on as a graphical interface. ID is an identifier, usually two letters. Process is the program or script to be executed. Actions include:

(1) defaultinit -- specify the default running mode (runlevel)

(2) sysinit -- specifies the first program/script to run. The runlevels field does not work at this time.

(3) boot -- run after sysinit, And the runlevels domain does not work

(4) bootwait -- same as boot, but init will wait for the end of the command

(5) once -- run when you enter the running mode specified by runlevels

(6) Wait -- same as above, but init will wait for the command to end

(7) respawn: run the command when the corresponding runlevel is entered. If the process ends, init starts another process to execute the same command.

(Icon_cool.gif ctrlaltdel -- specifies the command to be executed when the user presses Ctrl-alt-Del.

For Linux, the execution sequence is:

/Etc/rc. d/rc. sysinit # The first script executed by init

/Etc/rc. d/RC $ runlevel # $ runlevel is the default running mode.

/Sbin/mingetty # Wait for User Login

INIT program

The INIT program is usually in/sbin or/bin and runs a series of programs and script files at system startup. Once the INIT program is called by the kernel, it becomes the No. 0th process of the system. This process is very important for the Linux system. For details about this process, see other materials. Every step of the INIT process is determined by the configuration in/etc/initab. The following is an example of radhat's/etc/inittab file:

Each line of the inittab file contains four fields in the format:

Code: runlevels: Action: Command

(1) The code field uses a single or two character sequence as the ID of the row. This ID is unique in this file. Some records in the file must use specific code to make the system work normally.

(2) The runlevels field shows the running level of the row. Linux runs at a certain level. When the inittab file specifies a specific running level, the commands contained in this record line will be executed. The RedHat system usually sets seven running levels (0-6). descriptions of each running level are included at the beginning of the inittab file.

(3) The action field indicates how the INIT program executes the command. For example, execute command only once, or restart when it exits.

(4) The command field provides the command to be executed by the corresponding record line

Running Level 1 is a single-user mode. A single user means that the system runs in the unique user-superuser mode. In most cases, the system runs in multi-user mode. When a startup error or file system error occurs, the system enters the single-user mode. At this time, the system has only a few configurations, which is necessary for restoring the system.

The inittab file first specifies the default running level (for example, ID: 3: initdefault :). We can see that the default running level is 3 in the above example. Then, according to the next record, the system should run/etc/rc. d/RC. sysinit, a script file, mainly includes basic system initialization commands, such as activating swap partitions, checking and mounting the file system, and loading some modules.

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.