18

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

2
  • 1
    Do you want to know if a GUI ist running or if it is installed (but not necessary running)?
    – user90883
    Oct 21, 2015 at 9:14
  • 1
    Please define "GUI". Oct 21, 2015 at 9:22

3 Answers 3

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
3
  • 1
    And there is still the possibility that someone installed a windows manager/desktop environment without using packages.
    – user90883
    Oct 21, 2015 at 9: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, 2015 at 9:29
  • Are there really "too many"?
    – Meetai.com
    Feb 16, 2018 at 3: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.)

1
  • It does not depends on package manager and still very realiable to uninstalls! Superb, very realiable way!
    – mvorisek
    Jun 27, 2019 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?!).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .