Friday, May 11, 2012

Linux Run Levels

Linux systems today generally use seven runlevels.

Runlevels define what services or processes should be running on the system.

The init process can run the system in one of seven runlevels. The system runs only one of the eight runlevels at a time.

The main runlevels are from 0 – 6. Here's what each runlevel is for:

Runlevel 0: Halt System - To shutdown the system
Runlevel 1: Single user mode
Runlevel 2: Basic multi user mode without NFS
Runlevel 3: Full multi user mode (text based)
Runlevel 4: unused
Runlevel 5: Multi user mode with Graphical User Interface
Runlevel 6: Reboot System

Runlevels 1 and 2 are generally used for debugging purposed only, and are not used during normal operations. Most desktop linux distributions boot into runlevel 5, which starts up the Graphical Login Prompt. This allows the user to use the system with X-Windows server enabled. Most servers boot into runlevel 3, which starts the text based login prompt.

Linux runlevels can be changed on the fly using the init tool. If you want to switch from text based operations to the Graphical Interface, you just have to type in 'telinit 5' in the root prompt. This will bring up the Graphical Interface in your system.

Each runlevel can be configured by the system administrator. The "/etc/inittab" file has information on which runlevel to start the system at and lists the processes to be run at each runlevel.

Each runlevel has its own directory structure where you can define the order in which the services start. These directories are located in the /etc/rc.d/ directory, under which you have rc1.d, rc2.d, rc3.d…. rc6.d directories where the number from 0 through 6 that corresponds to the runlevel.

Refer to Wiki for runlevels on different Operating Systems.

No comments:

Post a Comment