4 Different commands to Check Ubuntu Server Version via Terminal

While using the Ubuntu command line server where there is no GUI, to easily get the OS version, the only resort left with us is the terminal. Hence, this article will discuss some common commands to use for finding the current version of the Ubuntu running server.

Get the Ubuntu server version

It is important to learn what version of Ubuntu you running before setting up server-related software on it. Because if you end up configuring the wrong version of software you will have compatibility issues. Furthermore, knowing the commands to retrieve and check the Ubuntu version will also help to a greater extent, if you are planning to upgrade the system.

1. Linux Standard Base (LSB) command

The first and one of the easiest commands to find the Linux OS version is “lsb_release”, it is a part of the Linux Standard (LSB) package. Well, if you run the LSB command and get the output “No LSB modules are available“; this means you have to install the LSB package first, for that we can use the command ‘sudo apt install lsb-release‘. After that run the given syntax and you will have the current version of your Ubuntu on the terminal.

lsb_release -a
lsb release command

2. Reading the /etc/os-release File

There is a file on Ubuntu and other Linux servers as well that is “/etc/os-release“, this file stores the system identification data, which we can read to get the details of our current operating system including the version. It is quite a straightforward method even than “lsb-release” because you don’t need to install any extra package. Moreover, it offers more details as well as the common URLs of the Ubuntu homepage including the NAME, VERSION_ID, and PRETTY_NAME. So, here is the command to use:

cat /etc/os-release
check Ubuntu server using etc os release

3. Fetching Ubuntu version from “/etc/issue File”

There is another file on our Ubuntu system that also holds the version information of the system OS, that is “/etc/issue“. This file often contains a simple message or system identification information, including the Ubuntu version. So, like the “/etc/os-release“, use the ‘cat‘ to read this file as well:

cat /etc/issue
Reading Etc Issue

4. hostnamectl Command

hostnamectl is one of the best commands to not only read the Ubuntu system version but also to print various other information such as Machine ID, Kernel, Architecture, Hardware Vendor & Model, and more… Even though we generally use the hostnamectl commands to change the hostname of the system, when used alone it reveals the system information.

use hostnamectl command to get ubuntu version

These were few commands – lsb-release, cat /etc/os-release, and hostnameclt, to quickly check the current version of any running Ubuntu server whether it is on physical or virtual machine.

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.