Understanding Linux Runlevels

Try it in our public cloud & Get $5 Credit
Understanding Linux Runlevels.

Understanding Linux Runlevels. Runlevel is a different mode that the Linux system used for different functions. There are differences in the runlevels according to the operating system. Typically, there are seven runlevel numbers from 0 to 6. You can switch to the other runlevel as per your need either by the system or manually by an administrator. Each runlevel has its own function.

A brief explanation of each runlevel is shown below:

0 : It is used to shutdown the system. Nothing run in this runlevel.
1 : It is a single user mode which means only root has access to the system. It does not allow non-root users to login and does not configure a network interface. Generally, this runlevel is used for recovery mode.
2 : It is a multi-user mode. This is very similar to level 1 but it allows other users to login.
3 : it is a multi-user mode with networking. Most services are runs in this level. The graphical interface also runs at this level.
4 : It is undefined that means you can create your own custom runlevel using it.
5 : It is a multi-user mode with graphical user interface. This is the standard runlevel for most of the LINUX based systems. So Linux desktop and the home user will generally get into this mode by default.
6 : It is used to reboot the system. When you switch to this level, the reboot process is initiated.

Switching to a Different Runlevel

Before starting, it is important for you to know what is your current runlevel?

You can simply run the following command to find your current runlevel:


You should see the following output:

 N 5

As you can see, the first number is the previous runlevel your system was running, and the second number is the current runlevel of your system. N stands for none that means the system was not in any different runlevel previously. The “5” means our system is currently in runlevel 5.

You can switch to the different runlevel manually using the the init command.

For example, if you want to reboot your system, change the runlevel to the 6 using the following command:

init 6

The above command will restart your system immediately.

Each runlevel has its own directory located inside /etc. You can list them with the following command:

ls /etc/ | grep ^rc

The output should be as following:


You can also list which processes are run in any run level. For example, list all processes run in the runlevel 2 using the following command:

ls /etc/rc2.d/

You should get the following output:

 README S20anydesk S20speech-dispatcher S70pppd-dns S99rc.local
 S16openvpn S20kerneloops S20virtualbox S91apache2
 S19mysql S20nginx S50saned S99grub-common
 S19postgresql S20rsync S70dns-clean S99ondemand

Change the default Runlevel

There are many reasons you might need to change the default runlevel of your system.

If you are a system administrator and want to boot system into command-line interface instead GUI interface.

For Ubuntu/Debian operating system, you can change the default runlevel by editing the file /etc/init/rc-sysinit.conf:

nano /etc/init/rc-sysinit.conf

Change the following line with your desired runlevel:


Save and close the file when you are finished. Then, restart your system to boot into new runlevel.

For CentOS/RHEL/Fedora operating system, you can achieve this by editing the file /etc/inittab:

nano /etc/inittab

Change the following line with your desired runlevel:


Save and close the file when you are finished. Then, restart your system to get into the new runlevel.


In the above guide, you learned what is runlevel and how to work with different runlevel. I hope this will helps you to understand the runlevel.