Run levels :Run levels will define what services or processes should be running on the system.The ‘ init ‘ process will take you to any of the run levels.System will run in any of the 8 run levels at a time.Among this 8 we are using only 0-6.When it enters level 0 it halts and reboot on enters on 6.Other levels 1-5 differ in terms which drives are mounted or which network services are started.Different run levels can be listed as
0 - Halt : is the system halt or power off automatically when it reaches the run level 0.But old version computer will powered on showing a message system is on HALT state.
1 - Single-user mode :It is also known as ‘rescue’ or trouble-shooting mode,no daemons are started here.You can boot in to this rescue mode by using your boot loaders like Grub or Lilo.
2 - Not used(user definable)
3 -full multi-user mode
4 -Not used(user definable)
5 - Full multi-user mode (with an X-based login screen)
Run levels 2-5 are full multi user mode.To use text console normally using level 3 and for using graphical interface level is set to 5.
6- Reboot : is used for system rebooting , once you set this and reboot your system you will be having two ways to change the setting .One is using a Live CD and mounting Linux partition on it ,reset the run level.Or else if you are using Grub as your boot loader you will have an option to set the run level as one.
Where this run levels live?
Run levels are defined in file systems.All these file systems are seen in a directory /etc. Each run level is actually, a set of programs that will be run.Run level 3 will have a certain set of programs. Run level 4 will have another set. of programs.names of these programs will be present in /etc/rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ folders,that is if add a link to a new program (some a.out for example), in rc4.d folder, it’ll be run automatically when you switch to run level 4.
The Init Program :the init process reads the file “/etc/inittab” and thus creates the process according to the run levels.This help a user to set the run level manually by
$ init 5 which will jump to level 5
For checking the current run levels ,on most systems users can check the current run level with either of the following commands:
$ runlevel
$ who -r
Credits : [WikiPedia, RedHat Docs, DebianHelp, CompTechDOC ]