Linux系统检查查看桌面环境

简介:

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工具连接到系统,执行此命名得不到任何结果。

clip_image001

clip_image002

上述命令我只是测试了两种桌面(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

clip_image003

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检查

  

相关文章
|
5月前
|
Ubuntu Linux Anolis
Linux系统禁用swap
本文介绍了在新版本Linux系统(如Ubuntu 20.04+、CentOS Stream、openEuler等)中禁用swap的两种方法。传统通过注释/etc/fstab中swap行的方式已失效,现需使用systemd管理swap.target服务或在/etc/fstab中添加noauto参数实现禁用。方法1通过屏蔽swap.target适用于新版系统,方法2通过修改fstab挂载选项更通用,兼容所有系统。
451 3
Linux系统禁用swap
|
5月前
|
Linux
Linux系统修改网卡名为eth0、eth1
在Linux系统中,可通过修改GRUB配置和创建Udev规则或使用systemd链接文件,将网卡名改为`eth0`、`eth1`等传统命名方式,适用于多种发行版并支持多网卡配置。
965 3
|
4月前
|
存储 Linux 开发工具
Linux环境下使用Buildroot配置软件包
使用Buildroot可以大大简化嵌入式Linux系统的开发和维护工作,但它需要对Linux系统和交叉编译有深入的理解。通过上述步骤,可以有效地配置和定制软件包,为特定的嵌入式应用构建高效、稳定的系统。
531 11
|
4月前
|
Linux 虚拟化 iOS开发
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
869 0
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
|
Ubuntu Linux 网络安全
Linux系统初始化脚本
一款支持Rocky、CentOS、Ubuntu、Debian、openEuler等主流Linux发行版的系统初始化Shell脚本,涵盖网络配置、主机名设置、镜像源更换、安全加固等多项功能,适配单/双网卡环境,支持UEFI引导,提供多版本下载与持续更新。
554 0
Linux系统初始化脚本
|
5月前
|
安全 Linux Shell
Linux系统提权方式全面总结:从基础到高级攻防技术
本文全面总结Linux系统提权技术,涵盖权限体系、配置错误、漏洞利用、密码攻击等方法,帮助安全研究人员掌握攻防技术,提升系统防护能力。
500 1
|
5月前
|
监控 安全 Linux
Linux系统提权之计划任务(Cron Jobs)提权
在Linux系统中,计划任务(Cron Jobs)常用于定时执行脚本或命令。若配置不当,攻击者可利用其提权至root权限。常见漏洞包括可写的Cron脚本、目录、通配符注入及PATH变量劫持。攻击者通过修改脚本、创建恶意任务或注入命令实现提权。系统管理员应遵循最小权限原则、使用绝对路径、避免通配符、设置安全PATH并定期审计,以防范此类攻击。
1150 1
|
安全 Linux 测试技术
配置Goby工具环境(win,linux,macOS)
配置Goby工具环境(win,linux,macOS)
1518 2
|
9月前
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
543 11