Detecting Linux distribution name and version

How to find out the Linux Distribution Name and Version?

We can use any of the following methods to find your Linux distribution and version name:

  1. /etc/*-release file - It displays the Linux distribution name and version.
  2. lsb_release command - It shows Linux distribution-specific information.
  3. proc/version file - This file is used to see the Linux kernel version currently running.
  4. hostnamectl command displays the hostname and Linux distro info on systemd based distros.

Detect what is a systemd-based distribution

This method will work in modern versions of Arch, CentOS, CoreOS, Debian, Fedora, Mageia, OpenSUSE, Red Hat Enterprise Linux, SUSE Linux Enterprise Server, Ubuntu, etc.

Uname - Print information about the current system

Uname is the short name for Unix name. Just type uname in the console to get information about your operating system.

All the options are as follows:

  • -s, --kernel-name it prints the kernel name.
  • -n, --nodename it prints the network node hostname.
  • -r, --kernel-release it prints the kernel release.
  • -v, --kernel-version it prints the kernel version.
  • -m, --the machine prints the machine hardware name.
  • -p, --processor prints the processor type, or "unknown."
  • -i, --hardware-platform, prints the hardware platform, or "unknown."
  • -o, --operating-system, prints the operating system.
  • --help it display a help message and exit.
  • --version it displays version information and exit.