To check the Linux version in Ubuntu, run the
lsb_release -a or
cat /etc/os-release command. This is useful when accessing a host for the first time or checking the running Linux distribution and version.
This blog post shows examples of 2 ways to check the Linux version of Ubuntu:
# Method 1: lsb_release -a
# Method 2: cat /etc/os-release
The demo you see here was done on Ubuntu WSL. Note that the
hostnamectl command does not work when running Ubuntu on the Windows Subsystem for Linux (WSL).
Method 1: lsb_release -a
lsb_release command is a simple way to check the version of Linux that is running on your system. To use it, open a terminal and run the following command:
# check linux version on ubuntu lsb_release -a
Method 2: cat /etc/os-release
Another way to check your Linux version is to display the contents of the
/etc/os-release file on your system. To do this, run the following command in your terminal:
# check linux version on ubuntu cat /etc/os-release
To find out more about WSL and Ubuntu, check out my WSL Ubuntu tag. You’ll find random blog posts on using and managing Ubuntu within Windows Subsystem for Linux.