A runlevel is a software configuration on the Linux system that allows only a selected group of processes to exist.
The “init” is the parent of all processes with PID 1. It’s primary purpose it to spawn(call forth) processes from a script stored in the “/etc/inittab” file. Init can be in any of the following runlevels:
- Runlevel 0 => Halt/Shutdown
- Runlevel 1 => Single User Mode(root)
- Runlevel 2 => Multi-user mode without networking
- Runlevel 3 => Multi-user mode with networking
- Runlevel 4 => Unused
- Runlevel 5 => X11
- Runlevel 6 => Reboot
Find out the current run level
Type the following command:
$ who -r run level 5 2011-11-11 18:53 last=3
Current runlevel is 5 and the last run level was 3.
The same information can be obtained from the “runlevel” command.
$ runlevel 3 5
Change the runlevel
The “init” command is used to change the runlevel.
For example “init 3” will move the system into runlevel 3.
# init 3
On most Linux servers the default runlevel is 3, whereas the Linux desktop systems default to runlevel 5. To change the default runlevel, edit the “initdefault” entry in the /etc/inittab file.
# vi /etc/inittab id:5:initdefault:
Save and close the file(zz). Reboot the system to see the changes.