IdentifyingDistros

How to tell the OS or Linux distribution of your shell session's host computer.

Target OS/distributions:

  1. CentOS?
  2. Debian
  3. Fedora
  4. FreeBSD?
  5. NetBSD?
  6. OpenBSD?
  7. RHEL
  8. Ubuntu

Methods:

  1. /proc/version
  2. /etc/issue
  3. /etc/os-release
  4. uname -a
  5. dmesg

CentOS?

Verified on ma.sdf.org

1.

Linux version 2.6.32-696.23.1.el6.x86_64 (mockbuild@x86-01.bsys.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Mar 13 22:44:18 UTC 2018

2.

CentOS release 6.9 (Final)
Kernel \r on an \m

3. (not available)

4.

Linux ma.sdf.org 2.6.32-696.23.1.el6.x86_64 #1 SMP Tue Mar 13 22:44:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

5.

Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-696.23.1.el6.x86_64 (mockbuild@x86-01.bsys.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Mar 13 22:44:18 UTC 2018
[...]

Debian

Verified on debian.polarhome.com

1.

Linux version 4.9.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3 (2017-12-03)

2.

Debian GNU/Linux 9 \n \l

3.

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/"

4.

Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3 (2017-12-03) x86_64 GNU/Linux

5. (not available)

Fedora

Verified on redhat.polarhome.com

1.

Linux version 3.9.10-100.fc17.x86_64 (mockbuild@bkernel01.phx2.fedoraproject.org) (gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC) ) #1 SMP Sun Jul 14 01:31:27 UTC 2013

2.

Fedora release 17 (Beefy Miracle)
Kernel \r on an \m (\l)

3.

NAME=Fedora
VERSION="17 (Beefy Miracle)"
ID=fedora
VERSION_ID=17
PRETTY_NAME="Fedora 17 (Beefy Miracle)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:17"

4.

Linux redhat.polarhome.com 3.9.10-100.fc17.x86_64 #1 SMP Sun Jul 14 01:31:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

5.

[7094464.803659] systemd-journald[311]: Rotating...
[...]

FreeBSD?

1.

2.

3.

4.

5.

NetBSD?

Verified on netbsd.polarhome.com

1.

NetBSD version 6.1.3 (netbsd@localhost) (gcc version 4.5.3) NetBSD 6.1.3 (GENERIC)

2. (not available; /etc/issue.net contents below)

NetBSD 6.1.3
Welcome to NetBSD ...member of polarhome.com realm

3. (not available)

4.

NetBSD netbsd.polarhome.com 6.1.3 NetBSD 6.1.3 (GENERIC) i386

5.

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.1.3 (GENERIC)
[...]

OpenBSD?

Verified on grex.org

1. (not available)

2. (not available)

3. (not available)

4.

OpenBSD grex.org 6.1 GENERIC#21 i386

5.

OpenBSD 6.1 (GENERIC) #21: Wed Oct  4 18:48:12 CEST 2017
    robert@syspatch-61-i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
[...]

RHEL

Verified on ___

1.

2.

3.

4.

5.

Ubuntu

Verified on tilde.town

1.

Linux version 4.4.0-98-generic (buildd@lcy01-03) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017

2.

Ubuntu 16.04.3 LTS \n \l

3.

NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

4.

Linux tilde.town 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

5.

[4527660.817533] [17542]   108 17542    16924      532      25       3        0             0 cleanup
[...]