There are few ways to figure out what version of Linux you are running on your machine as well as distribution name.
Let's start:
First of all, run:
uname -a
Linux vm-6 6.0.9-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 16 17:50:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
that will give you some idea on the architecture, Linux kernel; sometime it will also indicate if it's Debian, CentOS, Ubuntu and so on. In our case it does not, so we move on.
Next, you will review **/proc/version**, which stores information about the system.
cat /proc/version
Linux version 6.0.9-200.fc36.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 12.2.1 20220819 (Red Hat 12.2.1-2), GNU ld version 2.37-36.fc36) #1 SMP PREEMPT_DYNAMIC Wed Nov 16 17:50:45 UTC 2022
This seems to be Fedora. The Fedora project is the upstream, community distro of Red Hat® Enterprise Linux.
* From the above, we establish the kernel that we are running: **Linux version 6.0.9-200.fc36.x86_64**
* Internal data on the user who compiled the kernel: **mockbuild@bkernel01.iad2.fedoraproject.org**
* A version of the GCC compiler to build the said kernel: **gcc (GCC) 12.2.1 20220819**
* Type of the kernel **#1 SMP** (Symmetric MultiProcessing Kernel) which supports multiple CPUs or/and CPU cores.
* Date and time when the kernel was compiled: **Wed Nov 16 17:50:45 UTC 2022**
Next, we can find out the distribution name and release version. For that, the best way to determine would be to review the **/etc/os-release** file. It is present almost on all Linux systems. Exceptions are some misc appliances, e.g. storage, TV, phones.
Please note that that depending on the distro, the /etc/os-release could be named something else.
* **cat /etc/os-release** for Ubuntu, Debian, Mint, RHEL or CentOS or Fedora, Rocky Linux, Alpine Linux, AlmaLinux
* **cat /etc/gentoo-release** for Gentoo Linux
* **cat /etc/SuSe-release** for OpenSUSE Linux
Here's an output for our Fedora Linux:
cat /etc/os-release
NAME="Fedora Linux"
VERSION="36 (Server Edition)"
ID=fedora
VERSION_ID=36
VERSION_CODENAME=""
PLATFORM_ID="platform:f36"
PRETTY_NAME="Fedora Linux 36 (Server Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:36"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=36
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=36
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Server Edition"
VARIANT_ID=server
We learn a bit more about our system. It is a **Fedora Linux 36 (Server Edition)**.
As an alternative, you can try running the **lsb_release** utility, which will print Linux Standard Base (LSB for short) information about the particular Linux distro you're running. The **lsb_release** may not be installed by default. Depending on the distribution, there are different ways on how to install it.
* **sudo yum install redhat-lsb-core** for RHEL or CentOS or Fedora, or Rocky Linux
* **sudo apt install lsb-release** for Debian, Ubuntu or Mint
* **sudo emerge -a sys-apps/lsb-release** for Gentoo
* **sudo apk add lsb_release** for Alpine
* **sudo pacman -S lsb-release** for Arch
* **sudo zypper install lsb-release** for OpenSUSE
Once installed, we run the utility by typing **lsb_release -a**
lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 36 (Thirty Six)
Release: 36
Codename: ThirtySix
It does match with the above, it is a 64bit version of Fedora 36 Linux.
Furthermore, you can use another tool, **hostnamectl**,
Static hostname: vm-6
Icon name: computer-vm
Chassis: vm П÷√╢
Machine ID: 8b145c3da3cd489bb2e6ck2634be28d3
Boot ID: 463eef4b0baa5dda8482a0f954671ae8
Virtualization: kvm
Operating System: Fedora Linux 36 (Server Edition)
CPE OS Name: cpe:/o:fedoraproject:fedora:36
Kernel: Linux 6.0.9-200.fc36.x86_64
Architecture: x86-64
Hardware Vendor: QEMU
Hardware Model: Standard PC _Q35 + ICH9, 2009_
this particular machine is running on the KVM technology (stands for Kernel-based Virtual Machines) and that it is **Fedora Linux 36** and **x86-64**