1RUNLEVEL(8) runlevel RUNLEVEL(8)
2
3
4
6 runlevel - Print previous and current SysV runlevel
7
9 runlevel [options...]
10
12 "Runlevels" are an obsolete way to start and stop groups of services
13 used in SysV init. systemd provides a compatibility layer that maps
14 runlevels to targets, and associated binaries like runlevel.
15 Nevertheless, only one runlevel can be "active" at a given time, while
16 systemd can activate multiple targets concurrently, so the mapping to
17 runlevels is confusing and only approximate. Runlevels should not be
18 used in new code, and are mostly useful as a shorthand way to refer the
19 matching systemd targets in kernel boot parameters.
20
21 Table 1. Mapping between runlevels and systemd targets
22 ┌─────────┬───────────────────┐
23 │Runlevel │ Target │
24 ├─────────┼───────────────────┤
25 │0 │ poweroff.target │
26 ├─────────┼───────────────────┤
27 │1 │ rescue.target │
28 ├─────────┼───────────────────┤
29 │2, 3, 4 │ multi-user.target │
30 ├─────────┼───────────────────┤
31 │5 │ graphical.target │
32 ├─────────┼───────────────────┤
33 │6 │ reboot.target │
34 └─────────┴───────────────────┘
35
37 runlevel prints the previous and current SysV runlevel if they are
38 known.
39
40 The two runlevel characters are separated by a single space character.
41 If a runlevel cannot be determined, N is printed instead. If neither
42 can be determined, the word "unknown" is printed.
43
44 Unless overridden in the environment, this will check the utmp database
45 for recent runlevel changes.
46
48 The following option is understood:
49
50 --help
51 Print a short help text and exit.
52
54 If one or both runlevels could be determined, 0 is returned, a non-zero
55 failure code otherwise.
56
58 $RUNLEVEL
59 If $RUNLEVEL is set, runlevel will print this value as current
60 runlevel and ignore utmp.
61
62 $PREVLEVEL
63 If $PREVLEVEL is set, runlevel will print this value as previous
64 runlevel and ignore utmp.
65
67 /run/utmp
68 The utmp database runlevel reads the previous and current runlevel
69 from.
70
72 systemd(1), systemd.target(5), systemctl(1)
73
74
75
76systemd 241 RUNLEVEL(8)