centos 开发可能会遇到命令行和图形界面来回切换,如何处理呢?
首先查看系统当前运行环境。
#非 root 用户添加 sudo 命令
#multi-user.target 带网络多用户控制台模式
[root@localhost ~]# systemctl get-default
multi-user.target
[root@localhost ~]#
切换到图形化界面命令如下
[root@localhost ~]# systemctl set-default graphical.target
Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
[root@localhost ~]#
重启系统即可生效。
补充一句,centos 如何使用 lsb_release 命令。
#安装 epel-release
[root@localhost ~]# yum install epel-release
#安装 redhat-lsb
[root@localhost ~]# yum install redhat-lsb
使用 lsb_release 命令。
[root@localhost ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.3.2011
Release: 8.3.2011
Codename: n/a
[root@localhost ~]#