How to Check Linux Version

Updated on

4 min read

Check Linux Version

When people refer to Linux, they are usually referring to a Linux distribution. Strictly speaking, Linux is a kernel, the core component of the operating system that, simply put, acts just like a bridge between the software applications and the hardware. A Linux distribution is an operating system made from a Linux kernel, GNU tools and libraries, and software collections. Usually, Linux distributions include desktop environments, package management system, and a set of preinstalled applications.

Some of the most popular Linux distributions are Debian, Red Hat, Ubuntu, Arch Linux, Fedora, CentOS, Kali Linux, OpenSUSE, Linux Mint, etc.

When you log in to a Linux system for the first time, before doing any work, it is always a good idea to check what version of Linux is running on the machine. For example, determining the Linux distribution can help you figure out what package manager you should use to install new packages.

This article shows how to check what Linux distribution and version is installed on your system using the command line.

lsb_release command

The lsb_release utility displays LSB (Linux Standard Base) information about the Linux distribution. This command should work on all Linux distributions that have the lsb-release package installed:

lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.5 (stretch)
Release:	9.5
Codename:	stretch

The Linux distribution and version are shown in the Description line. As you can see from the output above, I have Debian GNU/Linux 9.5 (stretch) installed on my system.

Instead of printing all of the above information, you can display the description line, which shows your Debian version passing the -d switch.

lsb_release -d

The output should look similar to below:

Description:	Debian GNU/Linux 9.5 (stretch)

If you get “command not found: lsb_release” you can try to identify the Linux version using some of the other methods below.

/etc/os-release file

The /etc/os-release file contains operating system identification data, including information about the distribution. This file is part of the systemd package and should be present on all system running systemd.

To view the contents of the os-release file, use either cat or less :

cat /etc/os-release

The output should look something like below:

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION="9 (stretch)"

/etc/issue file

The /etc/issue file contains a system identification text that is printed before the login prompt. Usually, this file includes information about the Linux version:

cat /etc/issue

The output will look something like this:

Debian GNU/Linux 9 \n \l

hostnamectl command

hostnamectl utility is part of systemd and is used to query and change the system hostname. This command also displays the Linux distribution and kernel version .

  Static hostname: debian9.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a92099e30f704d559adb18ebc12ddac4
           Boot ID: 7607cbe605d44f638d6542d4c7b3878e
    Virtualization: qemu
  Operating System: Debian GNU/Linux 9 (stretch)
            Kernel: Linux 4.9.0-8-amd64
      Architecture: x86-64

/etc/*release file

If none of the commands above work for you, then most likely, you are running a very old and outdated Linux distribution. In this case, you can use one of the following commands, which should print the content of the distribution release or version file:

cat /etc/*release
cat /etc/*version

You can find more information about the release/version files at this link .

uname command

The uname command displays several system information, including the Linux kernel architecture, name, version, and release.

To find out what version of the Linux kernel is running on your system, type the following command:

uname -srm
Linux 4.9.0-8-amd64 x86_64

The output above tells us that the Linux kernel is 64-bit, and its version is “4.9.0-8-amd64”.


There are several different commands that can help you find out the Linux distribution and version is running on the system.

If you have a Linux distribution with a desktop environment, you can also check your distribution and version from the graphical interface.

Feel free to leave a comment if you have any questions.