I have a shared hosting. I have access to shell. The OS is Ubuntu, and I want to check whether it is the server version or desktop version.

When I log in through shell, it shows following information:

Linux [server-name] 2.6.32-24-generic #39-Ubuntu SMP Wed Jul 28 06:07:29 UTC 2010 i686 GNU/Linux
Ubuntu 10.04.1 LTS

13 Answers 13

dpkg -l ubuntu-desktop 

will tell you if the suggested desktop components are installed.

uname -a

will tell you whether the server or generic kernel is being used.

"Desktop or server" is not a binary thing - it's possible to have some desktop components installed on a machine originally installed as a server, etc.

You have to decide what package you want to use as the key distinction between "server" or "desktop". Maybe xserver-xorg is a good choice, though even some servers will have that for package dependencies or to support remote desktops.

  • 2
    dpkg -i ubuntu-desktop doesn't do what you describe for me.
    – 8128
    Nov 10, 2010 at 20:57
  • 2
    Sorry, I meant dpkg -l. (Updated.)
    – poolie
    Nov 10, 2010 at 21:01
  • 2
    It's possible to have a perfectly working desktop without the ubuntu-desktop package. That's just a metapackage to ensure a certain standard set of supporting applications such as control panels, Debian-specific things etc are installed along with your desktop. If you remove any of these then ubuntu-desktop will effectively be "removed" too but you'll still have a desktop. It'd be much better to check for the xserver-xorg-core package instead. Although, the existence of that package doesn't guarantee it's being used, there's no good reason to have it installed on a non-desktop machine. Apr 23, 2012 at 6:27
  • Yes, the fact that there is no sharp line between desktop and server has been extensively discussed by most answers, including mine. But ubuntu-desktop is a reasonable test for whether you have Ubuntu desktop. If you install from the desktop CD/ISO, you will have this package.
    – poolie
    Aug 5, 2013 at 2:42

This answer isn't as cut and dry as some people are making out. You can do a ubuntu-standard package install and use that as a server. You can use ubuntu-minimal as a server. You can take ubuntu-desktop and break it so it doesn't use X... Or even leave X there for administration (eww). You can change the kernel packages from -server to -generic to -rt etc. You can change the motd or even just upgrade from a version where the motd isn't as long as the new one (none of my servers have ever come out with all that guff -- probably because they're upgraded from older LTSes).

I guess the questions that all of us should be asking are: Why does it matter? What are you trying to learn? What difference does it make to you?

If you're trying to run something graphical, check for what you actually need (X, x11vnc, etc). If you're trying to check that there isn't a graphical interface, do the same!

  • 1
    +1. Why it matters? Well, consider ksplice. Desktop is free, server is not ... ;) Mar 8, 2011 at 23:38
  • 1
    Well, that's a more specific question: what does ksplice check to decide whether you can use the free desktop version. I would guess they check for the desktop vs server kernel build.
    – poolie
    Apr 29, 2011 at 5:41
  • 1
    Why does it matter? I don't have authority to replace the system, so need to unclusterfsck it, starting with knowing what it was originally. What are you trying to learn? Only what was asked for: was it a server or desktop install. What differene does it make to you? If it was a server install and it's full of X stuff, we should fire our IT people, etc.. Dec 26, 2017 at 22:38
  • @JanKyuPeblik If you're handed a broken system and it's not obviously a desktop, you should ask the person reporting the fault. Seriously. Computers aren't cars. It's not a spec list of operating values and tolerances. It's all configurable. The point here —applied to your thoughts— is the person handing the system could easily have taken a server and configured it to be a desktop. If you turn it back into a server, you've done harm. The technical distinction between the two at install time is not relevant to a problem. And what distinction there was in 2010 is now considerable slighter.
    – Oli
    Dec 27, 2017 at 21:34
  • All I got out of that was "history is stupid". Dec 28, 2017 at 21:14

it can be checked by typing cat /etc/motd. The output will be defferent on server and different on desktop edition.


Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/


Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Nov 10 20:54:11 UTC 2010

  System load:  0.07               Processes:           78
  Usage of /:   30.4% of 14.76GB   Users logged in:     1
  Memory usage: 38%                IP address for eth0: XXXXXXXX
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/
At the moment, only the core of the system is installed. To tune the 
system to your needs, you can choose to install one or more          
predefined collections of software by running the following          

   sudo tasksel --section server  

It is also worth mentioning that this file is easily editable by sudo, which is done very often, because it's the message that user sees when he logs via ssh.

  • 2
    This is mostly telling you whether landscape-client is installed. That may happen to be true on servers, but it's not really essentially connected to whether you're using the server OS or not.
    – poolie
    Nov 11, 2010 at 1:04
  • 5
    I am running Ubuntu 20.04.3 LTS and /etc/motd.d is a folder. /etc/motd do not exist on my machine... Just saying
    – Mustafa
    Aug 29, 2021 at 11:34

This may not be the fastest or purest way to tell, but run:

dpkg --get-selections | grep linux-image | grep -v deinstall

If the currently installed linux-image package contains the word "server" in it, then you're running Ubuntu server.

For example, the current latest kernel package for Ubuntu 10.10 desktop:


And server:


For a more generic package that should be the same across different versions of Ubuntu, linux-image-generic is the default package for Ubuntu desktop and linux-image-server is the default for the server edition.

  • 4
    You can run the server kernel on a desktop install just as you can run the desktop kernel on a server. This is not a definitive answer by any stretch.
    – Oli
    Nov 10, 2010 at 22:18
  • @Oli: as you already pointed out, there seems not to be a definite answer ;) Mar 8, 2011 at 23:39

I am running discovery on a large network and I'm trying to distinguish from LINUX installed as a workstation versus a server (because we'll treat them differently).

I was hoping for the an attribute or file that had Ubuntu-Server instead of Ubuntu.

I do find some interesting files in /var/log/installer:

media-info says "Ubuntu-Server" for the server and just "Ubuntu" for desktop. syslog shows the same information for the "cdrom"

Both of these are helpful and I can use them in conjunction with hardware information. This should tell you at least what version was installed originally.


"Almost" the same question has been asked here: Know Ubuntu Distribution server or desktop

I would like to post my answer here as well because it has a few new hints how to check if your on a desktop or server edition.

As mentioned in previous posts, it's not easy to determine if you use a desktop or server edition because all package can be installed or removed.

If you are in a consistent and predictable environment it shouldn't be very difficult to determine if desktop or server.

I use only ubuntu-desktop (vanilla) or ubuntu server. For me the dpkg -l ubuntu-desktop it's a very reliable method to determine if its a desktop or server.

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?

  • Well, this an old question but I can answer two issues:
    – Wastrel
    Nov 8, 2021 at 20:23

There is no clearly defined, simply worded answer for this question.

It is possible to load the desktop features to server, and to remove them from desktop. The root issue is what packages are part of server functionality, and will get the additional period of support and updates.

The best answer (IMHO) can be found in a Launchpad question (from 2008):

what's the difference between server and desktop edition?



You must remember that there is no fundamental difference between the Desktop and Server editions.

It is highly likely however that your hosting provider has not got all the graphical pieces, such as GNOME on the top of the stack, because there is no need of them. The installed packages is what makes it a server.

You might be interested in ubuntu-maintenance-check script (link) that tells you the maintenance cycle of each package installed - those that have a longer period are server packages.


Check existing dirs in home dir. In Desktop edition you can see folders like Music, Downloads, Desktop.


This is important for my use case because I am using Ansible to desktop mods to both Server and Desktop models. However if it is a server I want to install ubuntu-desktop-minimal but if it detects a Desktop I don't want to install a desktop environment.

In this case, I have found that a server, even with ubuntu-desktop-minimal does not have the presence of a /cdrom directory but the Desktop installed from its ISO does. I am not sure if a server installing the full ubuntu-desktop will have that directory or not.


None of the above solutions worked very well for me. Sometimes a system doesn't have a motd, or maybe the admin changed it, etc. I'm not even sure why the answer given above was the "correct" answer. Here's what I ended up using.

__check_desktop() {
  if [ `(dpkg-query -W -f='${Status}' ubuntu-desktop 2>/dev/null | grep -c "ok installed")` -eq 1 ]; then
    err "Ubuntu Server is required, but it appears that you are running Ubuntu Desktop"
    exit 1

# Now just call the function:
  • Using -f with ${Status} is good and I will use it. But don't use bash with sh syntax and non-existent functions such as 'err'. Aug 26, 2019 at 11:12

With so many variants, such as kubuntu, lubuntu, xubuntu etc plus ubuntu-desktop-minimal it is perhaps more reliable to search for desktop.

The command I use is apt list --installed | grep desktop and if that doesn't come up with anything, grep for one of the above desktop variants.

In my most recent test case, I couldn't remember what I installed on a Raspberry Pi Ubunto ros robot, and the above command reminded me that I indeed had ubuntu-desktop-minimal, where dpkg -l ubuntu-desktop just said no packages found.


Looking at @poolie answer, I wrote these small functions in bash that will return desktop or server. This is assuming that server does not contain ubuntu-desktop package. It usually shouldn't contain that package.

function isDesktopOrServer() {
    dpkg -l ubuntu-desktop > /dev/null 2>&1
    if [[ $? -eq 0 ]]; then

You must log in to answer this question.

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