Linux中使用init命令关机、重启、切换模式等
正在学习Linux中。。。一边学一边记录着。。所有观点只是个人观点
Linux有个文件 /etc/inittab
复制代码
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#</p> <p># Default runlevel. The runlevels used by RHS 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:3:initdefault:
代码如下:
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#</p> <p># Default runlevel. The runlevels used by RHS 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:3:initdefault:
0是关机
1是单用户
2是多用户,不联网
3是多用户
4是不使用的
5是xwindows,也就是有界面的
6是重启
init命令很简单。直接输入init + 你想要的模式 回车就行。
比如 输入 : init 0 就是关机
init 3 就是切换到多用户
init 5 就是切换到界面
init 6 就是重启
我实验的时候都是在root用户下进行的,不知道其它用户可不可以,再实验实验。