1. 程式人生 > >Centos 從多使用者終端切換到桌面

Centos 從多使用者終端切換到桌面

Centos 從多使用者終端切換到桌面

1. 問題

如何從centos的多使用者介面,切換到桌面呢?

2. 解決辦法

2.1 tty 命令
tty - print the file name of the terminal connected to standard input

列印連線到標準輸出的終端檔名。

  • 在桌面的terminal下執行tty命令:
[[email protected] ~]$ tty
/dev/pts/0
  • 在xshell環境中執行 tty 命令【命令列模式】
[[email protected]
~]$ tty /dev/pts/1
2.2 檢視 /etc/inittab檔案
[[email protected] zookeeper-3.4.11]# 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 #
[[email protected] zookeeper-3.4.11]# systemctl get-default
multi-user.target
[
[email protected] zookeeper-3.4.11]# systemctl set-defaultgraphical.target Unknown operation 'set-defaultgraphical.target'. [[email protected] zookeeper-3.4.11]# 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.

重啟

[[email protected] zookeeper-3.4.11]# reboot

這樣就可以從命令列介面切換到了桌面模式。