Definition

runlevel

What is runlevel?

A runlevel is an operating state on a Unix and Unix-based operating system that is preset on the Linux-based system. Runlevels are numbered from zero to six.

Runlevels determine which programs can execute after the OS boots up. The runlevel defines the state of the machine after boot.

Systems administrators set the default runlevel of a system according to their needs. Administrators also use the runlevel command to find out the machine's current runlevel to assess a system. For example, the runlevel can indicate whether the system's network is operational. Use the runlevel command /sbin/runlevel to find the current and previous runlevel of an OS.

Runlevels 1 through 6 are generally delegated to single-user mode, multi-user mode with and without network services started, system shutdown and system reboot. The setup of these configurations differs between Linux distributions and Unix versions.

Each basic level has a different purpose. Runlevels 0, 1 and 6 are always the same. Runlevels 2, 3, 4 and 5 are different depending upon the Linux distribution in use. Only one runlevel is executed when the system is booted. They are not implemented sequentially. For example, either Runlevel 4 or 5 or 6 is executed, not 4 then 5 then 6.

Each runlevel has its own systemd-target. Runlevels relate to specific systemd-targets. Systemd-targets are methods of starting up Linux-based systems. They are written out commands which differ from a runlevel command that consists only of a number.

Runlevel Purpose Systemd-targets
Runlevel 0 Shuts down the system poweroff.target
Runlevel 1 Single-user mode rescue.target
Runlevel 2 Multi-user mode without networking multi-user.target
Runlevel 3 Multi-user mode with networking multi-user.target
Runlevel 4 User-definable multi-user.target
Runlevel 5 Multi-user mode with networking (supports GUI) graphical.target
Runlevel 6 Reboots the system to restart it reboot.target

Users can modify the preset runlevels or even create new ones if needed.

Booting a system into different runlevels solves certain problems. For example, if a machine fails to boot due to a damaged configuration file, refuses to let the user log in due to a corrupted /etc/passwd file or if the user forgets their password, single-user mode can solve these problems.

This was last updated in October 2023

Dig Deeper on Data center ops, monitoring and management

SearchWindowsServer
Cloud Computing
Storage
Sustainability and ESG
Close