Skip to main content
Maher Sakka
Main navigation
  • Home
  • Contact me
Language switcher
  • English
  • عربي
Breadcrumb
  1. Home
  2. Blog
  3. How To Determine Which Linux Distribution and Kernel Version You Are Running

How to determine which Linux distribution and kernel version you are running

Image

When connecting to a Linux server, we need to know the name of the running Linux distribution, its version number, and the kernel version number.

This is often done to determine:

  • Commands for installing and updating software/packages (Package Management Tools): These commands vary from one distribution to another. For example, Debian and Ubuntu rely on the apt-get command, while CentOS and RedHat rely on the yum command.
  • Commands to be used
  • Versions of software/packages that we may install

These points vary from distribution to distribution and even from release to release.

You can use one of the following two methods to find out the name and version number of the running distribution:

The first method to find out your current Linux distribution

The first method involves using the command:

cat /etc/*-release

Response example for Ubuntu 12.04:

root@remote:~# cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

Response example for Debian 7:

root@remote:~# cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"

Response example for CentOS 6.4:

[root@remote~]# cat /etc/*-release
CentOS release 6.4 (Final)
12.5.30 cos6.build1205150826.19
CentOS release 6.4 (Final)
CentOS release 6.4 (Final)

The second way to find your current Linux distribution

The second and less commonly used method is:

$ lsb_release -a

Response example for Ubuntu 12.04:

root@remote:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise

Finding the Linux kernel version

To find the Linux kernel version, you can use the command:

$ uname -mrs

Some responses to the command:

Linux 2.6.32-042stab120.18 
x86_64Linux 3.16.0-4-amd64 x86_64
Linux 3.13.0-55-generic x86_64

The information can be extracted as follows:
Kernel name: Linux
Kernel version number: 3.13.0-55-generic
Device type: x86_64

Tags
  • Linux
Related posts
  • How to Find Recently Modified Files in Linux
  • How to compress and decompress files in Linux with ZIP
  • How to compress and extract TAR files in Linux
  • How to get the size of directories in Linux
  • How to find files that contain specific text in Linux
Tags
  • Laravel
  • Linux
  • Drupal
  • Database
  • Tips & Tricks
  • Mobile
Recent posts
  • How to Find Recently Modified Files in Linux
  • How to determine which Linux distribution and kernel version you are running
  • Send an email to multiple recipients at once
Monthly archive
  • May 2017 (2)
  • August 2018 (1)
  • October 2020 (1)
  • August 2023 (1)
  • July 2024 (2)
  • November 2024 (1)
  • July 2025 (10)
Projects
  • elmanager.tn
  • 365mathex.com
  • vpop.tn
  • toufoula.tn
  • writethemoney.com
  • dinartunisien.com
RSS feed

mahersakka.com © 2024