Run-level defines the state in which O.S. and its services
are running.
There are total 7 run-levels in linux and system can be
booted in any of these run-levels.
Run-level
|
Description
|
0
|
Halt
/ Shutdown
|
1
|
Single
User Mode
|
2
|
Multi
User without NFS
|
3
|
Full
Multiuser
|
4
|
Unused
|
5
|
X11
(Graphical Mode)
|
6
|
Reboot
|
By default linux boots in either run-level 3 or 5
The init program is used to handle all the run-levels and
its process id is 1.
You can also check the process id of init using below command
[root@server]$ ps -aux |
grep init
root 1
0.0 0.1 31032
1880 ? Ss Sep30
0:19 /sbin/init
The /etc/inittab file contains the information regarding the run-levels.
Issue the command cat /etc/inittab
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3,
if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
Here, see the last line in file “id:5:initdefault:” which
states that the run-level of the system is 5. You can also change the run-level
to 3 or 1 as per your convenience but keep in mind that these changes are
permanent.
To change the run-level temporarily simply you can type the
command “init run-level” i.e. init 3.
How to check the
current run-level ?
runlevel command
is used to check the current run-level.
[root@server]$ runlevel
N 3
Here, N means previous run-level and 3 is the current
run-level.
You can also use the command who –r
[root@server]$ who -r
run-level 3 2014-09-30 04:23
No comments:
Post a Comment