1. 程式人生 > >Centos7設定預設進入圖形介面和命令列介面

Centos7設定預設進入圖形介面和命令列介面

相比7之前的版本,在centos7版本中,設定OS啟動預設進入圖形介面還是文字介面有了點變化。

檢視當前預設設定

systemctl get-default
graphical.target #預設圖形介面

設定開始進入命令列介面:

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.

設定開始進入圖形介面:

systemctl set-default grphical.target

閱讀/etc/inittab,也可以發現如下內容

[[email protected] ~]# 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 --->告訴我們multi-user.target相當於以前的runlevel 3
# graphical.target: analogous to runlevel 5 --->告訴我們graphical.target相當於以前的runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#

命令列輸入:

init 3

進入命令列介面

init 5

進入圖形介面