This tutorial explains Linux “runlevel” command, options and its usage with examples.
DESCRIPTION
Runlevel reads the system utmp file (typically /var/run/utmp) to locate the runlevel record, and then prints the previous and current system runlevel on its standard output, separated by a single space. If there is no previous system runlevel, the letter N will be printed instead.
If no utmp file exists, or if no runlevel record can be found, runlevel prints the word unknown and exits with an error.
Another way to find the current and previous runlevels is to use the who command with its -r option, i.e.,
who -r
The utmp file allows one to discover information about who is currently using the system. There may be more users currently using the system, because not all programs use utmp logging.
Runlevel 0 is halt
Runlevel 1 is single-user
Runlevels 2-5 are multi-user (some distro uses RUN level 5 to start X [KDE/Gnome])
Runlevel 6 is for rebooting system
SYNOPSIS
runlevel [utmp]
OPTION
utmp
The name of the utmp file to read.
EXAMPLE
1. Simple Example
$ runlevel
N 2
Runlevel reads the system utmp file (typically /var/run/utmp) to locate the runlevel record, and then prints the previous and current system runlevel on its screen.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
- Check Linux Books
- Practice Programming MCQs
- Apply for Programming Internship
- Check Information Technology Books