Operating levels in Linux systems

Source: Internet
Author: User

What is a run level? Simply put, the run level is the functional level that the operating system is currently running. It allows some programs to start at one level, while another level does not start.

There are 10 0~9 of valid login modes in Linux system, but the limit of 6 kinds of UNIX system is generally only 1 to 6. From 1 to 6, with different functions.

There are various scripts in the/ETC/RC.D/INIT.D, each running level corresponding to the file/etc/rc.d/rcn.d, select the script you want to run at that level, from the/ETC/RC.D/INIT.D link.

The run-level files are defined under/etc/inittab. This file is the main file that the INIT program looks for,

Init is the root process in a Linux system and is the ancestor of all processes in the system. Its main function is to produce a process based on a script program recorded in the/etc/inittab. This file is typically used to control the user's login mode.

The standard Linux run level is 3 or 5, and if it is 3, the system is in multi-user state. If it is 5, it is running the X Window system. If you are currently 3 or 5, and you have reduced the run level to 2, Init will execute the k45named script.

The different run levels are defined as follows: (refer to Linux/etc/inittab)

# The default run level, the level used by RHS is as follows:

# 0-Shut down, machine off.

# 1-Single user mode. Just like the safe mode under Win9x.

# 2-Multiple users, but no NFS access to multi-user mode without network Service

# 3-Full multi-user mode, is the standard run level.

# 4-not used, generally not, in some special cases you can use it to do something. For example, when the battery of a laptop is exhausted, you can switch to this mode to

# 5-x11, into the X Window System.

# 6-Reboot, run init 6 machine will restart

Init is typically run automatically at system startup, or it can be called by the root user. Its role is to switch the operating state of the system.

Its command format is: Init num〈 carriage return, where NUM represents any number from 1 to 6.

Two of the 6 modes are system-default:

0: Stop the system from running. Init 0〈 carriage return) is equivalent to Halt〈 carriage return.

6: Reboot the system. Init 6〈 carriage return) is equivalent to Reboot〈 carriage return.

In the terminal, we can type Init < run level > to switch the runlevel to achieve some purpose,

If the input init 0 causes the system to shut down, enter init 6 to restart the system.

If you are using the text login screen, you are operating in run Level 3. If you are using a graphical login screen, you are operating in run Level 5.

The default runlevel can be changed by modifying the/etc/inittab file, which has a line near the beginning that resembles the following:

Id:5:initdefault:

Change the number in this line to the level you want to run. The changes will not take effect until the system reboots.

To change the runlevel immediately, use the command Telinit followed by the run-level numbers. You must be a root user to use this command

Different run 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.

At the Lilo prompt after startup, enter:

Init=/bin/sh RW

You can get the machine into run Level 1 and hang the root file system as read-write. It skips all system certifications, lets you use the passwd program to change the root password, and then boots to a new run level

Operating levels in Linux systems

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.