Sunday, January 16, 2011

How To Determine The Current Runlevel In Linux


The different runlevel values are as follows:
  • 0 = Halt the system
  • 1 = Enter single-user mode (no networking is enabled)
  • 2 = Multiuser mode, but without NFS
  • 3 = Full multiuser mode (normal operation)
  • 4 = Unused
  • 5 = Same as runlevel 3, except that it uses the X Window System to login rather than the text-based login system
  • 6 = Reboot the system
The exact setup of these configurations will vary from different operating system to operating system, and from one Linux distribution to another. When installing Linux, it is best to consult that distribution’s available user guides. In standard practice, when a computer enters runlevel zero, it halts, and when it enters runlevel six, it reboots. Default runlevels are typically 3 or 5.
How to determine the current run level?
There are different ways of finding the current runlevel in Linux. Two of them are as follows:

$ who -r
You can also use the option --runlevel instead of -r.

Linux has another command called runlevel which also prints the current runlevel.

$ runlevel

1 comment: