as the title:

How can I find which desktop environment I am using?

I want to accomplish this using command line.

  • 1
    this topic is also discussed here 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' 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). Aug 10 '14 at 15:40
  • @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 '19 at 20:32

And you can try $DESKTOP_SESSION for the DE.

  • 19
    when I type $ echo $DESKTOP_SESSION, it show: ubuntu why this?
    – Yishu Fang
    Apr 25 '12 at 14:27
  • 7
    Desktop session != Window manager
    – Tachyons
    Apr 25 '12 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 '12 at 14:38
  • 15
    Ubuntu is the name of the gnome 3+unity DE. 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
  • 2
    This is the only simple answer that worked for me. gnome-session
    – Jacksonkr
    Jun 28 '16 at 15:40
  • 1
    /usr/bin/dbus-run-session which one is this?
    – iamgr007
    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. Sep 16 '16 at 17:39
  • 4
    This only shows which DE's you have installed, not which is currently used.
    – Albin
    Apr 5 '19 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).
f - XFCE under Debian Buster


  • 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


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

  • Adding case f (Raspberry Pi 2 running 2016-05-27 Jessie): echo $DESKTOP_SESSION ==> LXDE-pi which says it all. Sep 16 '16 at 17:32
  • 3
    What do mean my "HardInfo" ? Can you please explain that Jun 17 '17 at 8:30
  • @AviMehenwal This answer explains it. Sep 13 '18 at 13:00
  • With gnome under Debian 8.11 DESKTOP_SESSION=default so for me the answer from @Nadew above worked Mar 27 '19 at 9:21
  • 2
    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 '19 at 4:17

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. May 8 '12 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 '20 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 '20 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 at 6:37

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.
    – Klesun
    Apr 26 '19 at 12:51
  • 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 '20 at 18:56
  • It works, but there can be false positives (e.g. "Ubuntu") if it is not one of the four in the filter ("gnome|kde|mate|cinnamon"). Jul 29 '20 at 13:48

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. 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. Jul 31 '13 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 '18 at 12:59
  • There's no mention of the DE in 18.04
    – Adam
    May 20 '19 at 11:56

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