How to check OS version in Linux – Ubuntu, Redhat, CentOS etc.

Checking the operating system version of your Linux installation is useful when you want to see what distribution you are running, the version number, and the kernel version information. This will clue you into what exactly your system is running under the hood.

Knowing what system you are working with is essential in helping you determine what package manager and other distribution-specific conventions to use in your Linux commands. In this tutorial, you will see how to find the OS version on Linux Desktops or Servers. 

Command Line Methods

There are multiple Linux commands that we can use to shed light on what OS version we are running in Linux. Check out some of the commands below.

1. The lsb_release Command

Run the lsb_release command with the -a option to check what Linux distribution and version your system is running.

lsb_release -a

Output:

No LSB modules are available.
Distributor ID:  Ubuntu
Description:     Ubuntu 22.04.1 LTS
Release:          22.04
Codename:     jammy

On our test system, the output shows us that we are running Ubuntu version 22.04.1 LTS (long-term support version). Many Linux distributions also use a codename for each release version – in this case, the release codename is “jammy” as shown in the output.

 

2. The uname Command

The uname command will give us Linux kernel information and should work on any Linux system. The kernel is the core of the Linux operating system, so knowing which version you are running will tell you exactly what features your system is capable of. We recommend running this command with the -r option.

uname -r

Output:

5.15.0-58-generic

The output shows that our test system is running Linux kernel version 5.15.0-58. Here is what each number means:

  • 5 = Kernel version major release
  • 15 = Major revision number
  • 0 = Minor revision number
  • 58 = Patch number

If you are interested in changing the Kernerl in Linux then see our tutorial how to change default kernel in Ubuntu 22.04 | 20.04 LTS

 

3. The hostnamectl Command

All systems with systemd (the vast majority of popular Linux distros these days) will include access to the hostnamectl command. Execute this command with no extra options in order to see the operating system release version and Linux kernel version.

hostnamectl

Output:

Static hostname: h2s
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 358cd02a3ef2489c8a9e892ce9114345
         Boot ID: 6b7768ddfa354a7c95d2f743319733ed

  Virtualization: vmware
Operating System: Ubuntu 22.04.1 LTS              
          Kernel: Linux 5.15.0-58-generic
    Architecture: x86-64
 Hardware Vendor: VMware, Inc.
 Hardware Model: VMware Virtual Platform

The output shows us that our operating system is Ubuntu 22.04.1 LTS and our kernel version is 5.15.0-58.

 

4. The /etc/os-release File

You can look inside of the /etc/os-release file for some information about your Linux operating system version. Just use cat or a similar command to check its contents. This file will only show up on Linux distributions running systemd.

cat /etc/os-release

Output:

PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

 

We can see that our operating system is Ubuntu 22.04.1 LTS Jammy Jellyfish, and the file also tells us that our system is based on Debian Linux with the ID_LIKE line.

 

5. The /etc/issue File

The /etc/issue file will ordinarily contain some information about your operating system’s version. This file is queried by Linux as a means of system identification before logging in.

cat /etc/issue

Output:

h2s@h2s-virtual-machine:~$ cat /etc/issue
Ubuntu 22.04.1 LTS \n \l

The file will show our operating system is Ubuntu version 22.04.1.

 

GUI Method

In case the command terminal is not your thing, you should be able to find all relevant operating system information from the GUI as well. The instructions may vary depending on the distribution you are using or the GUI you have installed, but here is the process for the GNOME desktop environment installed on Ubuntu:

Step 1: Open the Settings menu from the top right of your screen, or from Ubuntu’s Activities menu.

Open Linux Settings

Step 2: Scroll down to the About section of the Settings menu.

Go to Ubuntu Linux About section

Step 3: In the right window pane, you will see relevant information like operating system name, version, PC architecture, and even GUI version.

Linux OS name Type and version infromation

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.