How to change runlevel in Linux

Basically, runlevel refers to preset operating state on a Unix-like operating systems. It means that in different runlevel various services can be activated based on the runlevel.

If you want to change the current runlevel to something else it is easily possible in Linux command and with utilizing few commands you can change the system runlevel if you have enough permission.

Always, it is better to know that in which runlevel the current system is running. Therefore, for knowing the current runlevel just type the following command in your console.

$ who -r

The output of the command should be something like this.

run-level 2 2013-04-25 13:19

This means that the current run level is 2 which according to the below table it is “Local Multiuser with Networking but without network service (like NFS)”.

0 –> Halt the system.
1 –> Single-user mode (for special administration).
2 –> Local Multiuser with Networking but without network service (like NFS).
3 –> Full Multiuser with Networking.
4 –> Not Used.
5 –> Full Multiuser with Networking and X Windows(GUI).
6 –> Reboot.

Now if you want to change the value of runlevel you can do something like following example,

$ sudo init 1

The mentioned example changes the computer runlevel from multiuser support to single user which means text-mode.

As you can see from above table runlevel number four is not used by system and it is free. As a result, this runlevel can be defined by the user and most of the time it is called as user-definable runlevel.

In addition, instead of using “halt” and “reboot” commands you can switch to runlevel 0 and 1 respectively.

Finally, if you want to change the runlevel permanently you need to edit ” /etc/inittab “.

You just only need to find the following line and change it to your desirable value.

Id: 5 : initdefault:

Bear in mind that after changing the mentioned file you need to reboot your computer again to see the change(s).

More information about runlevel can be found in the man page of “init” command.

send your idea and information to kasra.madadipouya@geeksweb.tk

Leave a Reply