18

I'm looking for command to check from terminal, is any GUI installed to my UBUNTU. I couldn't find any satisfying answer

Khokon
  • 181

3 Answers3

13
dpkg -l|grep xserver

will tell you if X11 (core system for most GUIs) is installed. To check if any desktops are installed, you will have to guess, as there are just too many. Try something like:

dpkg -l|egrep -i "(kde|gnome|lxde|xfce|mint|unity|fluxbox|openbox)" | grep -v library
Silent-Bob
  • 467
  • 3
  • 9
  • 1
    And there is still the possibility that someone installed a windows manager/desktop environment without using packages. –  Oct 21 '15 at 09:27
  • This will also return a false positive if the X server was installed and then removed. And if the X server was installed by hand (or another package system), it will return false. You could use something like which Xorg, but that's also not 100% sure. – chaos Oct 21 '15 at 09:29
  • Are there really "too many"? – Meetai.com Feb 16 '18 at 03:37
7

There are many parts in a GUI, and it's possible that some part would be installed but some other parts would be missing.

Displaying a GUI locally (as opposed to running GUI programs over the network, displaying them remotely) requires an X server. So if you want to know whether a local GUI is installed, test for the presence of an X server. The X server for local display is Xorg.

type Xorg

will tell you whether it's installed. It won't tell you whether it's working or running, those would be different questions altogether.

(Recent versions of Ubuntu have introduced a new GUI, Mir, but X should still be available.)

  • It does not depends on package manager and still very realiable to uninstalls! Superb, very realiable way! – mvorisek Jun 27 '19 at 14:10
7

Type this command:

ls /usr/bin/*session

Based on what you see on the screen you can find out what GUI you are using right now. For example you are:

  • in GNOME if it returns /usr/bin/gnome-session (and more);

  • in MATE if it returns /usr/bin/mate-session (and more);

  • in LXDE if it returns /usr/bin/lxsession (and more);

  • in JWM if it returns /usr/bin/icewm-session (should be jwm-session, not?!).