146

as the title:

How can I find which desktop environment I am using?

I want to accomplish this using command line.

Lucio
  • 19,191
  • 32
  • 112
  • 191
Yishu Fang
  • 2,615

6 Answers6

91

And you can try $DESKTOP_SESSION for the DE.

user55822
  • 3,245
82

This command seems to be useful:

ls /usr/bin/*session
  • in GNOME returns /usr/bin/gnome-session (and more)
  • in MATE returns /usr/bin/mate-session (and more)
  • in LXDE returns /usr/bin/lxsession (and more)
  • in JWM returns /usr/bin/icewm-session (should be jwm-session, not?!)
Pablo Bianchi
  • 17,371
Nadiw
  • 821
  • 6
  • 2
30

I've tested the best tools I've found with:

a - GNOME under Linux Mint installed
b - GNOME under Linux Mint Live USB
c - MATE under Linux Mint
d - LXDE under Lubuntu
e - JWM under Puppy Linux (JWM is not a desktop environment but a stacking window manager).
f - XFCE under Debian Buster

Results

  • env | grep DESKTOP_SESSION= (so-so)

    a & b - DESKTOP_SESSION=gnome
    c - DESKTOP_SESSION=default.desktop
    d - DESKTOP_SESSION=Lubuntu
    e - Nothing
    f - DESKTOP_SESSION=xfce
    
  • echo $GDMSESSION (so-so)

    a & b - gnome
    c - Nothing
    d - Lubuntu
    e - Nothing
    f - xfce
    
  • pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce|jwm" or ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm" (well, but not perfect)

    a & b - OK
    c - OK
    d - WRONG
    e - Nothing & OK
    f - OK
    
  • HardInfo (very well, but not perfect)

    a - Nothing
    b - GNOME 2.32.0
    c - MATE
    d - LXDE (Lubuntu)
    e - Unknown (Window Manager: JWM)
    f - XFCE
    

Conclusion

A combination of HardInfo and the command ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm" probably will give the desired answer.

Pablo Bianchi
  • 17,371
Madiue
  • 301
  • 3
  • 2
18

For the window manager you can use:

sudo apt-get install wmctrl
wmctrl -m | grep "Name:" | awk '{print $2}'
Yishu Fang
  • 2,615
10

In a terminal or console, you can run:

pgrep -l "gnome|kde|mate|cinnamon"

or

ps -A | egrep -i "gnome|kde|mate|cinnamon"

The item that appears in more lines should be the answer

Lucio
  • 19,191
  • 32
  • 112
  • 191
Adesi
  • 121
  • 1
  • 2
1

You can run HardInfo. It's ready by default at least in Linux Mint; or you could install it (from Synaptic, ...).

You can run it a) from the main menu > Search box > hardinfo, or b) from the main menu > All applications > System Tools or Administration > System Information, or c) from the main menu > All applications > All > System Information, or d) from a terminal or console > hardinfo > Enter, or e) from the Run Application dialog (Alt+F2) > hardinfo > Enter.

Once HardInfo opens you just need to need to click on the "Operating System" item and look to the "Desktop Environment" line.

Nowadays, apart from GNOME and KDE, you could find MATE, Cinnamon, ...

Adesi
  • 121
  • 1
  • 2