If you've ever worked with an older Linux system, you've probably heard of runlevels. These numbered states determined which services were running on the system. While modern Linux distributions have moved on to systemd targets, the core concepts remain, and the old runlevel commands still work thanks to a compatibility layer.
Here's a quick and sweet breakdown of the old runlevels and their new systemd equivalents:
Runlevel 0 ➡️ poweroff.target
This is the halt or shutdown state. When you set the system to runlevel 0, it gracefully powers off. Think of it as the ultimate "off" switch.
Runlevel 1 ➡️ rescue.target
Also known as single-user mode, this is your go-to for system maintenance. It starts a minimal environment with a root shell, no networking, and very few services running. It's the perfect place to fix a broken system.
Runlevel 2 ➡️ multi-user.target
This is a non-graphical, multi-user mode. All essential services are started, and multiple users can log in via a console or SSH. It's often the default state for servers that don't need a graphical user interface.
Runlevel 3 ➡️ multi-user.target
Similar to runlevel 2, this state provides a multi-user, non-graphical environment, but with full networking support. In many distributions, runlevels 2 and 3 are identical.
Runlevel 4 ➡️ multi-user.target
This is a user-definable runlevel. In practice, it's typically configured to be the same as runlevel 3. It's a handy "placeholder" for custom configurations.
Runlevel 5 ➡️ graphical.target
This is the default for most desktops. It's a multi-user environment that also starts the display manager and graphical user interface (GUI). If you use a Linux desktop, you're likely running in this mode.
Runlevel 6 ➡️ reboot.target
As the name suggests, this runlevel tells the system to reboot. It's the equivalent of a full system restart.
What Runlevel Am I In?
Method 1: Using the who command
who -r command provides a clean, detailed output of your system's current runlevel and the time it was entered. This is a great way to see if your system is running in a minimal or graphical state.
Example Output:
[root@jaytest ~]# who -r
run-level 3 2023-10-02 20:44
In this example, the system is in run-level 3. This means it's operating in a multi-user, non-graphical mode with full networking capabilities—a typical state for a server.
Method 2: Using the runlevel command
For a no-frills, direct answer, the runlevel command is your best friend. It shows two values: the previous runlevel and the current one.
Example Output:
[root@jaytest ~]# runlevel
N 3
Monday, 3 October 2022
Understanding Linux Runlevels
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.