Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

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
    
@Luis Alvarado Is desktop environment and window manager are same (because marked as duplicate)? –  Pandya Aug 10 at 5:02
    
@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 at 15:40

6 Answers 6

up vote 9 down vote accepted

And you can try $DESKTOP_SESSION for the DE.

share|improve this answer
    
when I type $ echo $DESKTOP_SESSION, it show: ubuntu why this? –  Yishu Fang Apr 25 '12 at 14:27
1  
Desktop session != Window manager –  Tachyons Apr 25 '12 at 14:30
    
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
4  
Ubuntu is the name of the gnome 3+unity DE. –  Javier Rivera Apr 25 '12 at 16:25

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
d - DESKTOP_SESSION=Lubuntu
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
d - WRONG
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.

share|improve this 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

For the window manager you can use:

sudo apt-get install wmctrl
wmctrl -m | grep "Name:" | awk '{print $2}'
share|improve this answer
    
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"

or

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

The item that appears in more lines should be the answer

share|improve this answer

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

share|improve this answer
    
I got /usr/bin/ck-launch-session /usr/bin/ck-xinit-session /usr/bin/gnome-session. So what? I'm using CentOS. –  SGG Mar 10 at 9:09

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

share|improve this answer
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

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