Operations 4 min read

Master Linux Runlevel: View and Change System Run Levels

This guide explains how the Linux runlevel command displays previous and current run levels, shows its syntax, provides practical examples, and expands on runlevel concepts, default levels, and their role in system boot and shutdown processes.

Open Source Linux
Open Source Linux
Open Source Linux
Master Linux Runlevel: View and Change System Run Levels

runlevel: Display System Run Level

Function Description

Using the runlevel command can output both the previous and the current run level. The command reads the system UTMP file; if no file is specified, it defaults to /var/run/utmp to locate the most recent run level records.

Command Syntax

runlevel [UTMP_file]

Examples

Example 1

Show the previous and current run level:

# runlevel
N 3
// N indicates there is no previous run level

Example 2

After switching the Linux system run level to 5, display the run levels:

# init 5

# runlevel
3 5
// Current run level is 5, previous run level was 3

Knowledge Expansion

The Linux operating system goes through several distinct stages during boot and shutdown; these stages are called runlevels. Similarly, shutting down the system also passes through specific runlevels.

Runlevels can be thought of as system states, analogous to Windows modes such as Normal, Safe Mode, and Command Prompt only. Entering each runlevel starts or stops a set of services, which are placed as init scripts in directories like /etc/rc.d/rc?.d/ or /etc/rc?.d/, where ? represents the runlevel number.

Most Linux distributions define eight runlevels:

0  Halt
1  Single-user mode
2  Multi-user, no NFS
3  Full multi-user mode
4  Unused
5  Graphical interface
6  Reboot
S  Single user mode (pre‑boot preparation)

Desktop Linux systems typically default to runlevel 5 (graphical interface), while server versions default to runlevel 3 (text console). Runlevels 1 and 2 are rarely used except for debugging, and runlevels s/S are reserved for preparing single‑user mode.

The advantage of Linux runlevels over Windows startup modes is that you can switch runlevels on the fly using the init command. When shutting down or restarting, the system invokes runlevel 0 or 6 to terminate all running processes gracefully.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSystem AdministrationinitRunlevelUTMP
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.