System States

By Danny Kalev, ITworld |  How-to

Systems States and their Meanings
A Linux system may run in one of seven possible states numbered from 0
to 6, as well as the single-user state that the letters s or S
represent. Here is a description of all these states:

* State 0 is the halt state. When you switch a system to state 0,
it will shutdown immediately.
* State 1, known as the administrative state, allows access only to
a super-user. Using this state, a system administrator can
perform various maintenance operations and installations without
interference from other users.
* State 2 is the partial multiple user state. It allows multiple
users to login but it disables remote file sharing.
* State 3 is the multiple user state. It allows multiple users to
login and enables remote file sharing. This is the default state
for the command line interface.
* State 4 is unused.
* State 5 is the default state for graphical logins that use
display managers such as gdm and xdm. If you choose to use
graphical logins during the installation process, this will be
your default state instead of state 3, which would be the default
otherwise.
* State 6 shuts down the system and reboots (note that state 0
shuts down the system without performing an automatic reboot
afterwards).
* State s or S is the single-user state. It restricts the number of
logged in users to one.

Detecting and Setting the System's State
To detect the state in which your system is currently running, use the
runlevel command (the term 'runlevel' is a synonym for 'state'). For
example:

#runlevel
N 3

On startup, Linux enters the default state. The system's default state
is stored in a file called /etc/inittab. You may override it by
changing the value of the init default entry. To change the current
system state, use the init command. For example, to switch to a single-
user mode, type the following command:

#init s

Likewise, to shut the system down immediately, use the following
command:

#init 0

Note, however, that, in general, you should use the 'shutdown' command.
It allows you to include a warning message that is sent to all the
users that are currently logged in or specify a delay.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question