centos7更改用户的默认运行级别
一 、7种运行级别
0 shutdown.target init 0:关机命令
1 emergency.target
2 rescure.target
3 mutil-user.target init 3:将当前运行级别切换为3 命令行模式
4 无
5 graphical.target init 5:将当前运行级别切换至5(图形模式)
6 reboot.target initi 6:重新启动(6 reboot.target)
二、运行级别的设置
1)语法:systemctl [command] [unit.target]
2)命令及参数:
command部分
get-default :获取当前的target;
set-default :将默认运行级别设置为指定的target;
isolate :切换至指定的运行级别。
unit.target部分:为上面1节部分中给出的运行级别
三、常用运行级别相关命令
1)systemctl
systemctl get-default:获取当前的运行级别;
systemctl set-default multi-user.target:将默认运行级别设置为mulit-user(重新启动后就会进入命令行模式);
systemctl isolate multi-user.target:不重启系统的情况下,将运行级别切换至mulit-user;
systemctl isolate graphical.target:不重启系统的情况下,将运行级别切换至图形模式。
2) 其他
runlvel:返回结果中,第一个数为之前运行级别,后一个数为当前运行