Ubuntu – Know Ubuntu Distribution server or desktop


I am asking question after googling and I tried multiple solution but need a specific answer.

I have logged in another pc with SSH and I need to know that the OS distribution is server or desktop.

I have tried following command and its output:

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise

Second Command

cat /proc/version

Linux version 3.5.0-61-generic (buildd@toyol) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #90-Ubuntu SMP Sun Apr 26 11:23:53 UTC 2015

Not at all duplicate with this

How to check if ubuntu desktop or server is installed?

Best Answer

As mentioned in the linked post, it's not easy to determine if you use a desktop or server edition because all packages can be installed or removed.

Here is my function I use for my scripts. Basically it checks if xserver-common or xwayland are installed. If one of them is installed it means its an desktop system.

#!/usr/bin/env bash

check_if_desktop (){

    'xserver-common' # X Window System (X.Org) infrastructure
    'xwayland' # Xwayland X server
  for i in "${displayManager[@]}"; do
    dpkg-query --show --showformat='${Status}\n' $i 2> /dev/null | grep "install ok installed" &> /dev/null
    if [[ $? -eq 0 ]]; then

Here are a few other things to check:

By default the server edition uses the classic /etc/network/interfaces, while the desktop edition operates with Network Manager, so check if Network Manager is installed

dpkg -l network-manager

Or run the command nmcli (the command line tool for NM) if you get a message like this:

The program 'nmcli' is currently not installed. You can install it by typing:
sudo apt-get install network-manager

the probability is high that you are on a server edition. But keep in mind, you can modify a server to operate with NM.

Use the following command to determine if desktop components are installed

dpkg -l ubuntu-desktop

On a Server you will get a message like this:

dpkg-query: no packages found matching ubuntu-desktop

On a Desktop you will get a message that tells you which version is installed

Check for other packages that are typically found on a desktop:

dpkg -l unity (gnome, mate and so one) # Desktop environments
dpkg -l compiz (E17, fluxbox and so one) # Window manager
dpkg -l xorg # X window server

or use:

 dpkg-query --show --showformat='${Status}\n' *packagename* 2> /dev/null | grep "install ok installed"

check if the X server is running:

ps -e | grep X
sudo netstat -lp | grep -i Xorg

Check for services that are only available on a desktop:

It depends on your Ubuntu version how to check the services:

sudo service *servicename* status # on SysVinit 
sudo status *servicename* # on Upstart
systemctl status *servicename*.service # on systemd

typical services are:

  • lightdm
  • x11-common
  • gnome-shell

and some others that are associated with certain derivatives

My application depends on server distribution

Even if it doesn't make any sense to run a server application on a desktop edition, there shouldn't be any issues with installing all the dependencies for your application on the desktop edition and make it working.

Can you elaborate on this why it depends on the server distro?

Related Question