This is one of the important term use in linux.What exactly the meaning of Runlevel.
In linux the Runlevel is described as the state or mode that is defined by the services.These services are defined in directory /etc/rc.d/ for eg …
[root@localhost ~]# cd /etc/rc.d/
[root@localhost rc.d]# ls
init.d rc0.d rc2.d rc4.d rc6.d rc.sysinit
rc rc1.d rc3.d rc5.d rc.local
here,inside directory /etc/rc.d/ there are some directory like rc0.d,rc2.d………rc6.d which represent the Runlevel.
These are the following Runlevel which are used in Linux
• 0 — Halt
• 1 — Single-user mode
• 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)
• 6 — Reboot
For text mode Runlevel 3 is used and for GUI (Graphical User Interface) Runlevel 5 is used.
We can change the runlevel of Linux O.S by doing editing in /etc/inittab file.
in /etc/inittab file there is a line…
here 5 represent the Runlevel 5.If we write 3 instead of 5 in this linethen machine will run in runlevel 3 in next restart.The /etc/inittab file is meant for bydefault runlevel setting of the O.S.
For Shuting down the Machine we can use the command init 0 and for restart command is init 6.
[root@localhost ~]# init 0
[root@localhost ~]# init 6