Run levels define what kind of environment or service to run automatically or manually when the system boots up. Run level revolves around the idea that different system can be used in different ways. The run level can provide a specific role at each level. Sometimes administrator doesn’t want to load the whole Linux OS instead but the administrator can load the OS with the minimal processes this is where the levels are defined.
Linux administrator may need to resolve or fix the Linux issues where the administrator can load the lower run level to diagnose.
There are total 7 run levels from 0 to 6, Once the system kernel loads, the init program reads the /etc/inittab file to check the behaviour for each run level. System boots in default run level which may be 3 or 5. If the system is without GUI then default run level is 3 and if the system boots up with the GUI then default run level is 5.
/etc/inittab is the file which has information about the run levels and which is going to be used. This spawns all other processes, It starts a daemon which PID is 1.
The applications that are started by init is located in the /etc/rc.d directory.
|0||Halt||Shuts down system|
|1||Single-User Mode||Does not configure network interfaces, start daemons, or allow non-root logins|
|2||Multi-User Mode||Multi user but without networking, doesn’t start network services|
|3||Multi-User Mode with Networking||Starts the system normally.|
|5||X11||As runlevel 3 + display manager(X)|
|6||Reboot||Reboots the system|
You can use a utility to check what services are started at which run levels
~]$ chkconfig –list
There is a command to check the run level and switch between run levels
~]$ runlevel xx
We can change the default run level in /etc/inittab file.
Be very careful while editing /etc/inittab. Simple typos can cause the system to become unbootable. If this happens, either use a boot diskette, enter into single-user mode or enter into rescue mode to boot the computer and repair the file.
I hope this has been informative for you. If it seems helpful then Like, Share and Don’t forget to subscribe to my channel