The output of the runlevel command will indicate your previous and current runlevel separated by a single space. If there was no previous runlevel ‘N’ will be used as a placeholder.
For example:
# runlevel N 5
The output above indicates that the current runlevel is 5 and there was no previous runlevel.
Below is the list of what each runlevel values are defined as:
- 0 — Halt
- 1 — Single-user mode
- 2 — Not used (user-definable)
- 3 — Full multi-user mode
- 4 — Not used (user-definable)
- 5 — Full multi-user mode (with an X-based login screen)
- 6 — Reboot
runlevel Command Examples
1. To see the current runlevel:
# runlevel
2. To suppress the output:
# runlevel -q # runlevel --quiet
3. To run in verbose mode:
# runlevel -v # runlevel --verbose
4. To get the version info:
# runlevel --version
5. To get the help:
# runlevel --help
FAQ on runlevel
Is there a standard runlevel that most people run after installation?
It depends on the requirement of the user, most of the times servers runs on runlevel 3 and desktop’s on runlevel 5. Runlevel 5 is ideal for a desktop workstation. And runlevel 3 is ideal for production.
Does running runlevel 5 consume a lot more resources than runlevel 3?
The only difference in runlevel 3 and runlevel 5 is that runlevel 5 includes X11 (GUI) service along with all other services like firewall, nfs, rpc ntpd etc.
Is there a way to shutdown X once you are done?
You can eaither logout the user under system menu, of you can go back to the console (CTRL+ALT+F1..7) and press CTRL+x to terminate the X session.
Over all, is there any benefit to running one runlevel over another?
To have one runlevel over other is beneficial in the way to implement GUI related application and have testing in the same environment without much load on server. for example Change your monitor or video card and you can run the the tools to adjust without having to try to stop the boot sequence and test it fully and if any problems just kill the GUI and try again, if some combination does cause the X server to lockup, you can kill X without having to reboot the system.
Conclusion
The /etc/inittab file defines the default runlevel for a system. The processes that start for specific runlevels are defined in subdirectories of the /etc/rc.d directory. You can view the current runlevel at any time using the runlevel command:
$ runlevel N 5