Linux系統檢查查看案頭環境,linux查看案頭環境

來源:互聯網
上載者:User

Linux系統檢查查看案頭環境,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工具串連到系統,執行此命名得不到任何結果。

上述命令我只是測試了兩種案頭(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檢查

 

參考資料:

http://superuser.com/questions/96151/how-do-i-check-whether-i-am-using-kde-or-gnome

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.