This question already has an answer here:

It is a quite basic question, but I couldn't find a satisfying answer anywhere:

How do I find out from the terminal what is the running GUI?

The system I'm working on is quite minimal, all I can see are xterm windows, from where I can open applications (in separate windows). I can open new xterm window by right click in a free area on the desktop. Every time I open an application, and hence a new window, in order to actually open the window, I have to mouse click on a free area of the screen.

I don't think this question is a duplicate of Is there a way to retrieve the name of the Desktop Environment?, because my setup is a bit different than in that one, and none of its answers work for me.

marked as duplicate by don_crissti, Anthon, Hauke Laging, vonbrand, slm Jun 4 '13 at 21:02

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.

  • DESKTOP_SESSION is not set. what does it mean to look for the running processes? – simona Jun 4 '13 at 18:23
  • none of the answers provided work for me. the system I'm working on is quite minimal, all I can see are xterm windows, from where I can open applications (in separate windows). does it even qualify as desktop environment? – simona Jun 5 '13 at 14:04
  • @don_crissti - there is no output – simona Jun 5 '13 at 14:25
  • @don_crissti - neither – simona Jun 5 '13 at 14:30
  • yes, it looks like that. so no GUI? – simona Jun 17 '13 at 19:08

You can type env to figure out what environments are configured.

The following response was found from this link

  XDG_CURRENT_DESKTOP - Tells you what Windows Manager you are using

  GDMSESSION - Tells you what option you selected from the lightdm greeter to login.

To use them, go to the terminal and type:


(Will output for example 'unity' if you are using Unity)



(Will output for example 'ubuntu' if you selected ubuntu in the login or 'ubuntu-2d' if you selected that one in the login.)

You have others if you look closer at the output of env like DESKTOP_SESSION and COMPIZ_CONFIG_PROFILE

Since what you are looking for is the name of what Window Manager is in usem the only way I see how to get this is by looking in the process list. To do this there is a command called pgrep ( Wikipedia ). I did the following to get the name since the parameter -l adds the process ID:

pgrep -l compiz |cut -d " " -f2 since the process is running by the same user there is no need to prefix the sudo part. You can then use this to create a script that does an action based on the Window Manager.

To look for other types, just change the word compiz to another like mutter, kwin, etc..

On Ubuntu 12.04 I tested environment variables XDG_CURRENT_DESKTOP and GDMSESSION and got the following results:







Gnome Classic


Gnome Classic no effects

XDG_CURRENT_DESKTOP=GNOME GDMSESSION=gnome-fallback Other Ubuntu based distributions:

Mint 13 (Cinnamon)


Lubuntu 12.04


  • If this question gets closed as a duplicate then you should copy your answer to the referenced question. – Hauke Laging Jun 4 '13 at 19:36

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