RUNLEVEL(8)
๐ RUNLEVEL(8) ๐
okay bestie, welcome to runlevel โ the little tool that prints your previous and current SysV runlevel. it lives in the systemd family (runlevel(8)), and yes, we're gonna get into why this is a bit of a legacy vibe. buckle up ๐
โจ SYNOPSIS โจ
runlevel [options...]
๐ธ OVERVIEW ๐ธ
so. "Runlevels" are an obsolete way to start and stop groups of services, used back in the day by SysV init. systemd ships a compatibility layer that maps runlevels onto targets, plus the associated binaries like runlevel. lowkey iconic of it to keep the lights on.
but here's the thing, bestie โ only one runlevel can be "active" at any given time, while systemd can activate multiple targets concurrently. so the mapping to runlevels is confusing and only approximate. it's giving โจvibes-based translationโจ
runlevels should not be used in new code. their main character moment is basically as a shorthand way to refer to the matching systemd targets in kernel boot parameters. that's it. that's the job. periodt.
Table 1. Mapping between runlevels and systemd targets (no table, just a slay little list, iykyk)
- runlevel
0โpoweroff.target - runlevel
1โrescue.target - runlevel
2,3,4โmulti-user.target - runlevel
5โgraphical.target - runlevel
6โreboot.target
๐ฆ DESCRIPTION ๐ฆ
runlevel prints the previous and current SysV runlevel, if they are known. if they're known, bestie. IF. ๐ญ
the two runlevel characters are separated by a single space character. cute, minimal, no notes.
if a runlevel can't be determined, N is printed instead. and if neither can be determined? it just prints the word unknown. very honest of it honestly.
unless it's overridden in the environment, this will check the utmp database for recent runlevel changes.
๐ OPTIONS ๐
the following option is understood (just the one, and she ate):
--helpโ print a short help text and exit. that's it, that's the whole option menu. short king ๐
โญ EXIT STATUS โญ
if one or both runlevels could be determined, 0 is returned. otherwise you get a non-zero failure code. no in-between, no nuance, just binary slay ๐
๐ ENVIRONMENT ๐
$RUNLEVELโ if$RUNLEVELis set,runlevelwill print this value as the current runlevel and ignoreutmp. it's taking the override, no cap.$PREVLEVELโ if$PREVLEVELis set,runlevelwill print this value as the previous runlevel and ignoreutmp. same energy, different variable ๐ซถ
๐ FILES ๐
/run/utmpโ theutmpdatabase thatrunlevelreads the previous and current runlevel from.
added in version 237. a whole era. ๐
๐ง SEE ALSO ๐ง
systemd(1), systemd.target(5), systemctl(1)
go read those next bestie, they're the real main characters of this story โจ
and that's the whole page, babes โ this lil manual came to you courtesy of systemd 257.13, the RUNLEVEL(8) page. stay slaying, stay mapped to the right target, and please don't write new code with runlevels. mwah ๐๐๐ฆ
๐ฆ where this page comes from
- debian trixie: systemd-sysv 257.13-1~deb13u1 ยท LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms