CentOS切换运行级别 图形模式/命令行模式
常见的运行级别说明
两种常见运行级别 multi-user.target(命令行) graphical.target(图形模式)
# multi-user.target: analogous to runlevel 5
# graphical.target: analogous to runlevel 5
运行级别说明表
#查看运行级别
- # systemctl get-default
#设置运行级别
- # systemctl set-default TARGET.target
设置CentOS为图形模式
- systemctl set-default graphical.target
设置CentOS为命令行模式
- systemctl set-default multi-user.target
##终端切换:
systemctl set-default multi-user.target ##设定默认为字符界面,也就是3
systemctl set-default graphical.target ##图形界面 5
查看对应配置文件
- vim /etc/inittab
查看运行级别
- runlevel
- vi /etc/systemd/system/default.target
root@centos:~重置
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Multi-User System
Documentation=man:systemd.special(7)
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
Systemd 电源管理命令
命令 | 操作 |
---|---|
systemctl reboot | 重启机器 |
systemctl poweroff | 关机 |
systemctl suspend | 待机 |
systemctl hibernate | 休眠 |
systemctl hybrid-sleep | 混合休眠模式(同时休眠到硬盘并待机) |