您的位置:首页 > 运维架构 > Linux

【Linux】系统运行级别

2016-06-02 19:31 435 查看

系统运行级别

系统运行有七个级别,分别是:

级别含义
0关机
1单用户模式,主要用于修复
2不完全的命令行模式,不含NFS服务
3完全的命令行模式
4系统保留
5图形模式
6重启动

查看运行级别

指令:runlevel



两个数字分别表示上次运行级别及当前所在运行级别,N表示none,表示开机就进入3级别

修改运行级别

指令:init [0-6]



init 5即进入图形界面模式 (如果装了图形界面的话即进入,如果没装图形界面则报错,但是报错信息不在远程连接工具上显示,仅在本机上显示)

init 0 //表示关机

init 6 //表示重新启动

修改开机默认运行级别

要修改开机默认运行级别,则要修改配置文件

/etc/inittab

inittab文件内容

# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# 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:3:initdefault:


修改最后一行id即可修改默认运行级别,不能将默认运行级别改为0和6.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux