runlevel: Check your current runlevel. Then change it

Today's commands are how you can check what runlevel your system is in and then change it.

Check the current runlevel:

[[email protected] tmp]# runlevel   
N 5

Change the current runlevel:

[[email protected] tmp]# init <new_level>

The run levels in Unix/Linux are used to define what state init (the parent of all processes) is in. Each distribution of Unix/Linux has different definitions of what run levels starts what processes.

Usually you can find the different definitions in /etc/inittab below is the one from a fedora box.

# Default runlevel. The runlevels used are:  
# 0 - halt (Do NOT set initdefault to this)  
# 1 - Single user mode  
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)  
# 3 - Full multiuser mode  
# 4 - unused  
# 5 - X11  
# 6 - reboot (Do NOT set initdefault to this)
Benjamin Cane
Principal Engineer, Vice President

Benjamin Cane is Principal Engineer at American Express. He has more than 16 years of experience with roles in both systems and software engineering. He leverages both his systems and software skills to build end-to-end platforms. Platforms, purpose built for performance and resiliency. Benjamin is also the author of Red Hat Enterprise Linux - Troubleshooting Guide (2015, Packt Publishing), and he has published many popular articles on topics such as Linux, Docker, Python, Go and Performance Tuning. Thoughts and Opinions expressed in my articles are my own.