Linux

How to check your current Runlevel in Linux

Runlevel is the operating system state on Linux system (it dictates the state that the machine is currently operating, and what applications or services can run at that time). There are seven (7) run levels numbered from 0 to 6. A system can be booted into any of the given runlevel. Runlevels are identified by numbers.

By default, a system boots either to runlevel 3 or to runlevel 5. Runlevel 3 is CLI, and 5 is GUI. There are different commands that can show the current run level state on a server.

  • Who Command
who -r 
  • Systemctl Command
systemctl get-default

Using /etc/inittab File
– The default runlevel for a system is specified in the /etc/inittab file

cat /etc/inittab

Using /etc/systemd/system/default.target File

The default runlevel for a system is specified in the /etc/systemd/system/default.target file for systemd System.

The following details show what each of the default runlevels represent. These are the standard definitions which may be slightly different depending on your Linux distribution.

  • 0 – is described as Halt. your machine will halt when the runlevel is set to 0.
  • 1 – is single-user Mode which is used for administrative tasks before the non-essential services are started.
  • 2 – is the first multi-user mode runlevel and will start some non-essential services. This may, or may not contain networking depending on your Linux distribution.
  • 3 – is a multi-user mode which headless servers usually run at. All essential and non-essential services such as Apache HTTP Server should be running.
  • 4 – is a multi-user mode runlevel which is not used by the default operating system and can be used for user defined purposes.
  • 5 – is when GUI desktops are loaded such as Gnome or KDE.
  • 6 – is the reboot runlevel. the operating system will reboot when runlevel 6 is issued.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x