How to Check Ubuntu Version with Command Line (Plus Upgrade)

How To Check Ubuntu Version With Command Line

Ubuntu is the most popular Linux operating system. From the early beginning, it comes with Long Term Support (LTS) for version delivered on April. For example, Ubuntu 20.04 means it is delivered on April 2020. This version has long term support for the next years. When the newest version delivered, there will be an option to upgrade it.

Now, to check Ubuntu operating system version, we will type the following command:

lsb_release -a

The result of the command will inform us version of our Ubuntu OS and the code name.

  • Distributor ID: Ubuntu
  • Description: Ubuntu 18.04.1 LTS
  • Release: 18.04
  • Code name: Bionic
How To Check Ubuntu Version With Ssh Command
How To Check Ubuntu Version With Ssh Command

Now, we would run type following updating software list command:

sudo apt update

After querying, the machine gives result of how many package can be updated. To list what package, we run the following command:

sudo apt list --upgradable

It is about 300 packages of software and 200 security updates. This is critical. So we will upgrade our system by typing this command:

sudo apt upgrade

It will takes a moment before the upgrading process finished.

Our new system will be ready now for development. Otherwise, when the checking version of Ubuntu is not satisfied, perhaps we shall do full upgrade process to the higher version of Ubuntu. To do this we are going to enter upgrade command. Please note that this is only suitable for empty server. That is, not productive server. Never do upgrade process on a productive running server because it will cause potential error due to incompatible package with already installed code for example website code or any scripts. Here are the recommendation method:

  • If you have productive server, let it as is
  • To migrate it to higher version of Ubuntu, instead of updating it directly, you could build from scratch building new environtment, deploying it and testing it before migrating
  • If the choice is upgrading the current running server, it is strongly suggested to back everything up including server configuration

In cloud platform, there are many ways to do the back up process with only several clicks. When they are available, do it first. Then you could upgrade it by the following command:

sudo do-release-upgrade

If we got message to reboot, then reboot it first. It is usually appear after updating with sudo apt upgrade command. You could reboot Ubuntu OS with command:

sudo reboot

Wait several seconds until the reboot process complete. Usually it takes maximum one minutes.

Here are several consideration before upgrading to higher version of Ubuntu:

  • The SSH connection will be restarted. If you are connected to your machine with SSH, please make sure the port is default 22.
  • There will be so many options while upgrading for example whether we want to keep the current version of a software of replacing it with the newer version.

That is why upgrading with this method is not suggested.


Upgrading a productive Linux Ubuntu operating system is different. It has many considerations before doing it. Moreover, newer not always better. Upgrading only needed when it is related with security issues.

I used to be a pilot, but ended up being just a mediocre writer.