How to Check Linux Version in Ubuntu

To check the Linux version running on an Ubuntu system, you can use the lsb_release -a or cat /etc/os-release commands. This is especially useful when accessing a host for the first time or verifying the installed Linux distribution and version.

In this post, I’ll demo two ways to show the Linux version in Ubuntu:
> Option 1: lsb_release -a
> Option 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).

Option 1: Using lsb_release -a

The lsb_release command provides a quick and simple way to check the version of Linux running on your system:

# check linux version on ubuntu
lsb_release -a
Ubuntu lsb_release

Option 2: Using cat /etc/os-release

Another way to do this is view the contents of the /etc/os-release file, which contains details about the Linux distribution.

# check linux version on ubuntu
cat /etc/os-release
Ubuntu /etc/os-release

When using Ubuntu in Windows Subsystem for Linux (WSL), some commands like hostnamectl may not work.

For more helpful tips and tricks, check out my WSL tag for random posts on managing and working with WSL.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *