Read in 4 minutes
How to 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 and more.
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 will help you figure out what package manager you should be using to install new packages.
In this tutorial, we’ll show you how to check what Linux distribution and version is installed on your system using the command line.
Checking Linux Version
There are several different commands that can help you figure out what Linux distribution and version is running on the system.
lsb_release utility displays LSB (Linux Standard Base) information about the Linux distribution. This command will work on all Linux distributions that have the
lsb-release package installed:
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 is 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
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 identify your Linux version using some of the other methods below.
/etc/os-release file contains operating system identification data including information about the distribution. This file is a part of the is part of the systemd package and all Linux system running systemd should have this file.
The output will look something like below:
PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
/etc/issue file contains a system identification text that is printed before the login prompt. Usually, this file includes information about the Linux version:
The output will look something like this:
Debian GNU/Linux 9 \n \l
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
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:
You can find more information about the release/version files at this link.
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:
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”.
In this guide, we have shown you how to find the version of Linux running on your system using the command line. If you have a Linux distribution with a desktop environment you can also check your distribution and its version from within the graphical interface.
Feel free to leave a comment if you have any questions.