Detecting Linux distribution name and version – Detect what RHEL / CentOS / Fedora distribution you are working in

Look at the contents of /etc/redhat-release

cat /etc/redhat-release

Here is the output from a Fedora 24 machine: Fedora release 24 (Twenty Four)


As mentioned in the debian-based response, you can also use the lsb_release -a command, which outputs this from a Fedora 24 machine:

LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:    Fedora
Description:    Fedora release 24 (Twenty Four)
Release:    24
Codename:    TwentyFour

if you want to reproduce, please indicate the source:
Detecting Linux distribution name and version – Detect what RHEL / CentOS / Fedora distribution you are working in - CodeDay