How to Check Linux Version in Ubuntu

🐧Part of the WSL Complete Guide, every Windows Subsystem for Linux post on this site, organised by task.

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.


Related

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.


Comments

Leave a Reply

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

Looking for SQL Server?

This site started as a SQL Server blog in 2017 and the archive is still here. The new SQL Server writing, and all the scripts, moved to a site of their own.

sqldba.blogScripts, error library, wait types, SSMS
Browse by topic