How To Check OS Version In Linux?

What's My Linux OS Version

GNU/Linux distros have lots of good things going for them. For example, they can be a refresher for someone from Windows or macOS. Many things in Linux are pretty similar to Windows, but what’s not identical is checking the OS version in Linux.

One can, arguably, go to the Settings > System Info on a Linux distribution, but provided there are tons of distributions out there, it’ll be hard for us to cover every single one of them as some of them differ. Therefore, in this article, let’s look at the three commands to check the OS version in Linux.

Check OS Version in Linux

Here are the three commands you can use to check the OS version in Linux.

1. Using The lsb_release Command

The lsb_release command (Linux Standard Base) is one of the easiest ways to get your system info and the Linux version. Here’s how to use it.

Open the terminal and type the following command.

lsb_release -a
lsb_release command linux

It gives the distributor ID, description, version, and distribution codename. “-a” stands for ‘all.’

2. Using the ‘hostnamectl’ Command

Another excellent command that gives out more info than lsb_release like the machine ID, boot ID, the Kernel version, the architecture, and hardware vendor.

hostnamectl command in linux

To use the command, open the terminal, type the command, and hit enter.


3. Using Cat To Fetch Data From /etc/os-release

The cat (concatenate) command in Linux, when used, reads the data from a file and displays it in the terminal. The file “os-release” in the ‘/etc.’ directory contains the OS info. By typing cat “/etc/os-release,” we’re asking cat to fetch the details in the os-release file.

cat /etc/os-release
cat etc-os-release command in linux

Cat’ing into the file doesn’t show the version number of the OS that you’re using. However, it does show you the name of the distro, the home URL, the documentation URL, and the bug report URL.

If you’re new to Linux and want to know more about the elements of the GNU/Linux family of distributions, we’ve got you covered.

Which Linux distribution are you using? Are you happy with the features it has on offer? Let us know your thoughts and opinions in the comments section below.

If you like this simple explainer, check out our Short Bytes section. We take complex tech topics and break them into short, easy-to-understand articles.

Similar Posts