1. 运行级别表如下:
| init级别 | systemctl target |
|---|---|
| 0 | shutdown.target |
| 1 | emergency.target |
| 2 | rescure.target |
| 3 | multi-user.target |
| 4 | 无 |
| 5 | graphical.target |
| 6 | 无 |
2. 设置默认运行级别,例如:
2.1 设置系统默认运行级别为3,也就是不启动桌面,而是黑窗口
systemctl set-default multi-user.target
2.2 设置系统默认运行级别为5,也就是默认启动桌面
systemctl set-default graphical.target
注:其他运行级别不要去尝试设置,消息系统无法正常启动。
3. 可以使用 init 切换系统运行级别,重启后失效,例如:
3.1 从系统运行级别5切换到系统运行级别3
init 3
3.2 从系统运行级别3切换到系统运行级别5
init 5
注:重启后失效,方法二,永久有效

本文详细介绍了Linux系统的运行级别,包括各个级别的含义及应用场景,并提供了如何设置默认运行级别和临时更改当前运行级别的具体命令。
554

被折叠的 条评论
为什么被折叠?



