Check the Ubuntu Server Version Installed/Running 1

With the increasing use of Linux, and specifically Ubuntu Server, in the Microsoft Azure ecosystem, it’s getting more important to know what version of the operating system is running. There are a couple simple methods that can be used to check the version of Ubuntu running on your Server or Desktop machine.

This article explains a few different methods for checking the installed version of Ubuntu on your server or desktop machine. The version method is the most commonly used and will work on most machines. However, there are cases where the first method may not work for you, so the following 3 methods provide alternatives to try.

Method 1: Check Ubuntu Version from SSH or Terminal

From the Terminal on the machine, or remotely connected over SSH, you can run the lsb_release command to check which version of Ubuntu is running. Using the -a switch will tell it to output all the version information for you.

lsb_release -a

Once the command executes you will see an output similar to the following; with the full Ubuntu version on the "Description" line:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic

To output just the Ubuntu version (not the full details), or just the "Description" value, then use the -d switch.

lsb_release -d

The "Description" only output will look similar to the following:

Description:    Ubuntu 18.04 LTS

Method 2: Check Ubuntu Version within the /etc/issue file

The /etc directory contains a file named /issue. This files contents is the System Identification text for the currently installed system. Outputting this files contents using the cat command in the terminal will output it’s value.

Here’s the command that will output this to the terminal:

cat /etc/issue

The terminal output will look similar to the following:

Ubuntu 18.04.3 LTS \n \l

Method 3: Check Ubuntu Version within the /etc/os-release file

This is a method that only works on the newer releases of Ubuntu, from 16.04 and newer. Within the /etc directory there is a file named os-release. You can use the cat command to output the contents of this file to the terminal. The file contents will contain the PRETTY_NAME and VERSION values that will contain the version of Ubuntu that is installed.

Here’s the command that will output this to the terminal:

cat /etc/os-release

Here’s a sample of the terminal output from this command

VERSION="18.04.3 LTS (Bionic Beaver)"
PRETTY_NAME="Ubuntu 18.04.3 LTS"

Method 4: Check Ubuntu Version using the hostnamectl command

This is a method that only works on newer releases of Ubuntu, from 16.04 and newer. The hostnamectl command can be run form the terminal or SSH to output the system hostname and related information for the machine. This information includes the Ubuntu version of the current machine.

Here’s the command to use:


The output of the command will look similar to the following:

Static hostname: UbuntuRDP
Icon name: computer-vm
Chassis: vm
Machine ID: 48ec2d49b2da435aa373c0f0ad96485e
Boot ID: 115f1b315f58439ebfde3d51b5edb072
Virtualization: microsoft
Operating System: Ubuntu 18.04.3 LTS
Kernel: Linux 5.0.0-1018-azure
Architecture: x86-64


Hopefully one of the various methods for checking the currently installed version of Ubuntu will work on the server in your environment. There are times when it’s important to be aware of the version of Ubuntu running, and this is especially true when looking to upgrade servers or check service compatibility.

This is a commonly searched for and used task by many IT Pros and Developers alike (including myself), so I thought I’d write up some information to help make it more discoverable and easier to find when needed.

I hope you find the tips useful!

Microsoft MVP

Chris Pietschmann is a Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT) with 20+ years of experience designing and building Cloud & Enterprise systems. He has worked with companies of all sizes from startups to large enterprises. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.
HashiCorp Ambassador Microsoft Certified Trainer (MCT) Microsoft Certified: Azure Solutions Architect