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.
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).
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
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.