CnetOS7以前版本:
方法一:不修改默认启动方式
root模式下:init 3 -->切换到命令行模式(并没有修改默认启动方式)(折中做法,每次这么操作很令人烦躁)
root模式下:init 5 -->切换到图形界面
CentOS7
[lwh@lwh ~]$ su root Password: [root@lwh lwh]# systemctl get-default graphical.target [root@lwh lwh]# 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@lwh lwh]# systemctl get-default multi-user.target [root@lwh lwh]#
参考:
https://blog.csdn.net/liangwenhao1108/article/details/104984247