[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檢查