1.目的
因为图形界面比较占用资源,在部署中为了不浪费资源,我们一般使用命令行界面,有需要的时候使用命令startx切换到图形界面
2.查看/etc/inittab文件,cat /etc/inittab
[root@zabbix-elk ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# 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 TARGET.target
#
3.查看当前默认模式
使用命令:systemctl get-default查看
[root@zabbix-elk ~]# systemctl get-default
multi-user.target
[root@zabbix-elk ~]#
4.设置默认模式
使用命令:systemctl set-default TARGET.target设置默认模式
systemctl set-default multi-user.target
systemctl set-default graphical.target
[root@zabbix-elk ~]# 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@zabbix-elk ~]# systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
5.重启验证
命令行模式切换到图形界面运行命令:startx
图形界面切换到命令行界面使用:CTRL+ALT+F3
命令行界面切换到图形界面使用:CTRL+ALT+F5
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。