133

as the title:

How can I find which desktop environment I am using?

I want to accomplish this using command line.

8
  • 2
    this topic is also discussed here Apr 25, 2012 at 14:29
  • 1
    @Luis Alvarado Is desktop environment and window manager are same (because marked as duplicate)?
    – Pandya
    Aug 10, 2014 at 5:02
  • 2
    @Pandya no, the values will be different, but on the duplicate it shows how to grab the value for both (And other examples for WM and DE). Aug 10, 2014 at 15:40
  • 2
    @Lucio, not sure why this question was erroneously marked as a duplicate of a completely different question. Please read this question first and remove the duplicate question marker: askubuntu.com/questions/18078/…
    – Mladen B.
    Dec 5, 2019 at 20:32
  • 1
    Just because the so called "original" contains an answer with solution to this question, does not mean that this question is a duplicate. The desktop environment and window manager are not the same things. These are different questions. The justification for closing this question is, quite simply, wrong, and the decision must be reversed.
    – MRule
    Sep 21, 2022 at 7:41

6 Answers 6

83

And you can try $DESKTOP_SESSION for the DE.

9
  • 20
    when I type $ echo $DESKTOP_SESSION, it show: ubuntu why this?
    – Yishu Fang
    Apr 25, 2012 at 14:27
  • 8
    Desktop session != Window manager
    – Tachyons
    Apr 25, 2012 at 14:30
  • 7
    My second problem is about DE (desktop environment), which you answered. I think the answer should be gnome, but it is ubuntu, why?
    – Yishu Fang
    Apr 25, 2012 at 14:38
  • 16
    Ubuntu is the name of the gnome 3+unity DE. Apr 25, 2012 at 16:25
  • 4
    echo $XDG_CURRENT_DESKTOP
    – Savrige
    Jun 16, 2021 at 12:18
72

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?!)
7
  • I got /usr/bin/ck-launch-session /usr/bin/ck-xinit-session /usr/bin/gnome-session. So what? I'm using CentOS.
    – gangadhars
    Mar 10, 2014 at 9:09
  • 2
    This is the only simple answer that worked for me. gnome-session
    – Jacksonkr
    Jun 28, 2016 at 15:40
  • 2
    /usr/bin/dbus-run-session which one is this?
    – iamgr007
    Aug 15, 2016 at 9:48
  • In the Raspberry Pi 2, we have a choice of 3 window sessions: lx and openbox. As I commented earlier, echo $DESKTOP_SESSION ==> LXDE-pi (installation value) is a definitive indicator for RPI2. Sep 16, 2016 at 17:39
  • 5
    This only shows which DE's you have installed, not which is currently used.
    – Albin
    Apr 5, 2019 at 17:01
29

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.

8
  • Adding case f (Raspberry Pi 2 running 2016-05-27 Jessie): echo $DESKTOP_SESSION ==> LXDE-pi which says it all. Sep 16, 2016 at 17:32
  • 4
    What do mean my "HardInfo" ? Can you please explain that Jun 17, 2017 at 8:30
  • @AviMehenwal This answer explains it. Sep 13, 2018 at 13:00
  • With gnome under Debian 8.11 DESKTOP_SESSION=default so for me the answer from @Nadew above worked Mar 27, 2019 at 9:21
  • 3
    in my case, I need to know if i am using unity or lxde, and after testing many commands, I found that env | grep XDG_CURRENT_DESKTOP says what i need. Aug 9, 2019 at 4:17
18

For the window manager you can use:

sudo apt-get install wmctrl
wmctrl -m | grep "Name:" | awk '{print $2}'
4
  • 1
    You can all about your system by just installing - Sysinfo. Search for it on USC. May 8, 2012 at 16:03
  • Sysinfo doesn't tell you which window manager you're using. It only tells you which version of xorg you're running -- at least on my system. Feb 23, 2020 at 19:37
  • This is the only answer that seems not only to work but work on all systems and provide output that is concise and incisive -- and I am not talking about "Curious Apprentice"'s answer. Curious Apprentice's "answer" should be ignored as it detracts from the only real answer. Feb 23, 2020 at 19:49
  • I would not consider the answer here as appropriate as the window manager is a own issue compared to the desktop env, please correct if I am wrong.
    – Timo
    May 16, 2021 at 6:37
9

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

2
  • 1
    I'm getting only 31 kdevtmpfs, 2026 gnome-keyring-d, 2201 polkit-gnome-au, and I'm on xfce.
    – Klesun
    Apr 26, 2019 at 12:51
  • 1
    same here. added xfce to the regex at least shows something useful, but a lot of heuristics would be required to determine with any certainty what DE you're using
    – code_monk
    Jun 15, 2020 at 18:56
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, ...

4
  • 1
    UniMous asked for command line option. He can not click from there. Unless this program can give a file output as report it does not useful for him. Apr 14, 2013 at 19:09
  • Find out how HardInfo gets the Desktop Environment and maybe you can find a way to do the same via the command line. Jul 31, 2013 at 23:21
  • 1
    You can install hardinfo with sudo apt-get install hardinfo on debian. It identified my desktop environment as XFCE 4. Sep 13, 2018 at 12:59
  • There's no mention of the DE in 18.04
    – Adam
    May 20, 2019 at 11:56

Not the answer you're looking for? Browse other questions tagged .