如何查看centos安装桌面环境

如题所述

Linux的桌面系统系统多达十几种,像gnome、kde、mate、cinnamon、lxde、xfce、jwm等。比较常用的一般是gnome、kde、xfce等。那么如何判断Linux系统安装了哪种桌面环境组件呢?下面总结了一些检查桌面环境的方法:
方法1:env | grep DESKTOP_SESSION= 或 echo $DESKTOP_SESSION
此命令只能进入桌面系统后,在桌面系统启动命令窗口执行才能得到结果,使用SecureCRT工具连接到系统,执行此命名得不到任何结果。
方法2:echo $GDMSESSION
此命令只能进入桌面系统后,在桌面系统启动命令窗口执行才能得到结果,使用SecureCRT工具连接到系统,执行此命名得不到任何结果。

上述命令我只是测试了两种桌面(KDE、GNOME)环境,不知道是否在其他桌面环境是否OK。参考资料里面介绍,这两个命令对于有些桌面环境并不能成功显示。

方法3:使用ps命令检查是否安装桌面环境

3.1: 没有安装任何桌面组件
[root@testlnx01 ~]# runlevel

N 3

[root@testlnx01 ~]# ps -A | egrep -i "gnome|kde|mate|cinnamon|lx|xfce|jwm"

3.2:安装了gnome桌面组件
[root@localhost ~]# ps -A | egrep -i "gnome|kde|mate|cinnamon|lx|xfce|jwm"
2304 ? 00:00:00 gnome-keyring-d
2314 ? 00:00:00 gnome-session
2352 ? 00:00:00 gnome-settings-
2377 ? 00:00:00 gnome-panel
2408 ? 00:00:00 gnome-power-man
2420 ? 00:00:00 polkit-gnome-au
2430 ? 00:00:00 gnome-volume-co
2448 ? 00:00:00 gnome-screensav
2497 ? 00:00:01 gnome-terminal
2500 ? 00:00:00 gnome-pty-helpe

pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce|jwm"
ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm"
使用ps命令或pgrep命令
[root@localhost ~]# ps -A | egrep -i "gnome|kde|mate|cinnamon|lx|xfce|jwm"
2304 ? 00:00:00 gnome-keyring-d
2314 ? 00:00:00 gnome-session
2352 ? 00:00:00 gnome-settings-
2377 ? 00:00:00 gnome-panel
2408 ? 00:00:00 gnome-power-man
2420 ? 00:00:00 polkit-gnome-au
2430 ? 00:00:00 gnome-volume-co
2448 ? 00:00:00 gnome-screensav
2497 ? 00:00:01 gnome-terminal
2500 ? 00:00:00 gnome-pty-helpe
[root@localhost ~]# pgrep -l "gnome|kde|mate|cinnamon|lx|xfce|jwm"
2304 gnome-keyring-d
2314 gnome-session
2352 gnome-settings-
2377 gnome-panel
2408 gnome-power-man
2420 polkit-gnome-au
2430 gnome-volume-co
2448 gnome-screensav

如果我将一个用户从桌面环境注销退出,如下所示,你会看到同样的命令显示的进程显然少了一些
[root@localhost ~]# pgrep -l "gnome|kde|mate|cinnamon|lx|xfce|jwm"
2882 gnome-session
2890 gnome-settings-
2909 polkit-gnome-au
2911 gnome-power-man
[root@localhost ~]# ps -A | egrep -i "gnome|kde|mate|cinnamon|lx|xfce|jwm"
2882 ? 00:00:00 gnome-session
2890 ? 00:00:00 gnome-settings-
2909 ? 00:00:00 polkit-gnome-au
2911 ? 00:00:00 gnome-power-man
[root@localhost ~]#

方法4: yum grouplist | more检查
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-03-23
一、首先查看系统的运行级别以及是否安装了桌面环境
  1、使用命令 runlevel 查看当前的运行级别 ,如图所示
  2、使用命令 yum grouplist | more 查看是否安装了桌面环境的组件,如图所示

二、再次从上面分析的结果看到,当前运行级别是3,而且也没有安装桌面环境的软件。
  然后我们使用命令查看一下桌面有哪些桌面环境的软件,然后装显示出来的软件组件就可以了。例如:
[root@localhost ~]#[root@localhost ~]# yum grouplist | more
Loaded plugins: fastestmirrorSetting up Group ProcessLoading mirror speeds from cached hostfile
* base: mirrors.usc.edu * extras: centos.mirror.ndchost.com *
updates: mirror-centos.hostingswift.com
Installed Groups: E-mail server Security Tools Storage
Availability Tools iSCSI Storage Client

Available Groups:
Additional Development
Backup Client Backup Server
Base CIFS file server
Client management tools
Compatibility libraries
Console internet tools
Debugging Tools
Desktop
Desktop Debugging and Performance Tools
Desktop Platform
Desktop Platform Development
Development tools
Dial-up Networking Support
Directory Client
Directory Server
Eclipse
Emacs
FCoE Storage Client
FTP server
Fonts
General Purpose Desktop
Graphical Administration Tools
Graphics Creation Tools
Hardware monitoring utilities
High Availability
High Availability Management
Identity Management Server
Infiniband Support
Input Methods
Internet Applications
Internet Browser
Java Platform
KDE Desktop
Large Systems Performance
Legacy UNIX compatibility
Legacy X Window System compatibility
Load Balancer
Mainframe Access
Messaging Client Support
MySQL Database client
MySQL Database server
NFS file server
Network Infrastructure Server
Network Storage Server
Network file system client
Networking Tools
Office Suite and Productivity
PHP Support
Performance Tools
Perl Support PostgreSQL
Database client
PostgreSQL Database server
Print Server
Printing client
Remote Desktop Clients
Resilient Storage
Ruby Support
SNMP Support
Scientific support
Server Platform
Server Platform Development
Smart card support
System Management
System administration本回答被提问者采纳
相似回答