运行级别
1. 运行级别说明:
(0)关机
(1)单用户 找回丢失的密码
(2)多用户状态没有网络服务 (用的非常少)
(3)多用户状态有网络服务
(4)系统未使用保留给用户 (用的非常少)
(5)图形界面 (多用户)
(6)系统重启
常用运行级别是3和5,也可以指定默认级别
命令: init
例:通过init来切换不通的级别,5切换到3
2. 指定运行级别
在/etc/inittab 文件中
multi-user.target: analogous to runlevel 3 //多用户状态有网络服务
graphical.target: analogous to runlevel 5 //图形界面
查看当前的运行级别:
To view current default target, run:
命令:systemctl get-default
设置默认的运行级别:
To set a default target, run:
命令:systemctl set-default + 级别名
例:systemctl set-default graphical.target
[root@localhost ~]# systemctl get-default
graphical.target
[root@localhost ~]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.
[root@localhost ~]# systemctl get-default
multi-user.target
3.找回root密码
该过程中用到的命令:
init=/bin/sh
mount -o remount,rw /
该过程中用到的命令:
passwd
touch /.autorelabel
exec /sbin/init