The runlevel is a software configuration of the system which allows only a selected group of processes to exist. Usually runlevel 0, 1 and 6 are the same and reserved for the following purposes :
0 – halt
1 – single mode
6 – reboot
Meanwhile runlevel 2,3,4 and 5 used for the following :
2 – Multi-User Mode
3 – Multi-User Mode with Networking
4 – Not used/User-definable
5 – Start the system normally with appropriate display manager. ( with GUI )
In this post, i will show two method to switching or changing between different runlevels on linux. The steps has been tested on CentOS 6.2.
Method 1. Changing run level temporarily without reboot :
In order to change the run level immediately without reboot, you can use init command. Assumed that you are currently in the default run level 3 and want to switch to run level 1 which is will enter single user mode, execute “init 1” :
[[email protected] ~]# init 1
To shutdown the system, execute “init 0” :
[[email protected] ~]# init 0
To reboots the system, execute “init 6” :
[[email protected] ~]# init 6
Please note that above command is not permanent and the system will return to default run level after reboot.
Method 2. Changing the run level permanently :
[[email protected] ~]# vi /etc/inittab
Let assumed the default run level is 3.
Change the initdefault to 5 as below :