This question already has an answer here:

as the title:

How can I find which desktop environment I am using?

I want to accomplish this using command line.

marked as duplicate by Luis Alvarado Apr 15 '13 at 2:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    this topic is also discussed here – Marius Balaban Apr 25 '12 at 14:29
  • If you are looking for a way to identify xubuntu vs lubuntu vs edubuntu etc. and your OSes were installed via CD, the following might help: grep cdrom: /etc/apt/sources.list | sed -n '1s|.*deb cdrom:\[\([^ ]* *[^ ]*\).*|\1|p' – Marnix A. van Ammers Jul 31 '13 at 23:30
  • 1
    @Luis Alvarado Is desktop environment and window manager are same (because marked as duplicate)? – Pandya Aug 10 '14 at 5:02
  • 1
    @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). – Luis Alvarado Aug 10 '14 at 15:40

And you can try $DESKTOP_SESSION for the DE.

  • 11
    when I type $ echo $DESKTOP_SESSION, it show: ubuntu why this? – Yishu Fang Apr 25 '12 at 14:27
  • 5
    Desktop session != Window manager – Tachyons Apr 25 '12 at 14:30
  • 5
    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 '12 at 14:38
  • 14
    Ubuntu is the name of the gnome 3+unity DE. – Javier Rivera Apr 25 '12 at 16:25
  • 2
    I get nothing, using Lubuntu 16.4 with lxde – Timo Dec 9 '17 at 8:34

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?!)

  • 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 '14 at 9:09
  • 1
    This is the only simple answer that worked for me. gnome-session – Jacksonkr Jun 28 '16 at 15:40
  • /usr/bin/dbus-run-session which one is this? – Nuwanda Aug 15 '16 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. – Richard Elkins Sep 16 '16 at 17:39
  • This only shows which DE's you have installed, not which is currently used. – Albin Apr 5 at 17:01

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).

My results:

  • env | grep DESKTOP_SESSION= (so-so)
a & b - DESKTOP_SESSION=gnome
c - DESKTOP_SESSION=default.desktop
e - Nothing
  • echo $GDMSESSION (so-so)
a & b - gnome
c - Nothing
d - Lubuntu
e - Nothing
  • 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
e - Nothing & OK
  • HardInfo (very well, but not perfect)
a - Nothing
b - GNOME 2.32.0
c - MATE
d - LXDE (Lubuntu)
e - Unknown (Window Manager: JWM)

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.

  • 1
    Please, take a time improving your answer adding format to it. Right now, is really hard to understand what are you trying to say and what is a command and what doesn't – Lucio Apr 14 '13 at 22:48
  • Adding case f (Raspberry Pi 2 running 2016-05-27 Jessie): echo $DESKTOP_SESSION ==> LXDE-pi which says it all. – Richard Elkins Sep 16 '16 at 17:32
  • 1
    What do mean my "HardInfo" ? Can you please explain that – Avi Mehenwal Jun 17 '17 at 8:30
  • @AviMehenwal This answer explains it. – Josiah Yoder Sep 13 '18 at 13:00
  • With gnome under Debian 8.11 DESKTOP_SESSION=default so for me the answer from @Nadew above worked – Till Kolditz Mar 27 at 9:21

For the window manager you can use:

sudo apt-get install wmctrl
wmctrl -m | grep "Name:" | awk '{print $2}'
  • 1
    You can all about your system by just installing - Sysinfo. Search for it on USC. – Curious Apprentice May 8 '12 at 16:03

In a terminal or console, you can run:

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


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

The item that appears in more lines should be the answer

  • I'm getting only 31 kdevtmpfs, 2026 gnome-keyring-d, 2201 polkit-gnome-au, and I'm on xfce. – Artur Klesun Apr 26 at 12:51

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, ...

  • 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. – Olcay Ertaş Apr 14 '13 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. – Marnix A. van Ammers Jul 31 '13 at 23:21
  • You can install hardinfo with sudo apt-get install hardinfo on debian. It identified my desktop environment as XFCE 4. – Josiah Yoder Sep 13 '18 at 12:59
  • There's no mention of the DE in 18.04 – Adam May 20 at 11:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.