Sometimes in our days as technical support we find the need to validate what type of OS install is on a machine as a way to identify the environment in which a product may be encountering difficulties.
To help with that discovery, here are two commands we have found to check if an Ubuntu OS install is a server version or desktop setup:
Command 1: root@ubuntu:/etc# dpkg -l ubuntu-desktop
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
ii ubuntu-desktop 1.267.1 The Ubuntu desktop system
Note: In the command 1 output, we can observe that "ubuntu-desktop" is listed. This shows that this a "Desktop" edition. If it is a "server" edition, the above outputs will have "server" instead of "desktop"
Command 2: root@ubuntu:/etc# dpkg --get-selections | grep linux-image | grep -v deinstall
In the command 2, "generic" is listed for "Desktop" edition.
Note: If it is a "server" edition, the above outputs will have "server" instead of "generic"