13

I want to know if the box is Fedora Core 4 or Redhat 9, or CentOS, etc... not if it has Kernel 2.6.x

6 Answers 6

4

On modern systems you should be able to look in /etc/lsb-release

mojo-jojo david% cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu karmic (development branch)"

This should be the LSB mandated way of finding out the distribution across different Linux distributions.

You should not rely on /etc/issue, as it is used for the login message, and someone might change it.

5
  • 1
    on centOS 5.3 that file doesn't exist, but the bin directory provides provides lsb_release as a command alternative
    – Zak
    Oct 5, 2009 at 23:21
  • lsb_release is not available on Fedora (21 Workstation) base image
    – ACyclic
    Mar 25, 2015 at 16:58
  • From the Wikipedia Linux Standard Base page: "The command lsb_release -a is available in many systems to get the LSB version details, or can be made available by installing an appropriate package, for example the redhat-lsb package on Red-Hat-flavored Linux distributions such as Fedora.[2]" en.wikipedia.org/wiki/Linux_Standard_Base Sep 14, 2015 at 1:25
  • 1
    lsb-release does not exist on fedora systems. The correct file is called system-release Sep 6, 2017 at 9:10
  • sudo dnf install lsb_release added the command. it wasn't needed as cat /etc/fedora-release gave the essential information: $ cat /etc/fedora-release Fedora release 39 (Thirty Nine) Feb 7 at 19:37
18

This perhaps?

[dummyuser@d400 ~]$ ls -l /etc/system-release
lrwxrwxrwx. 1 root root 14 2009-06-04 19:05 /etc/system-release -> fedora-release

[dummuser@d400 ~]$ cat /etc/system-release
Fedora release 11 (Leonidas)

4

Even better, and *nixwide:

lsb_release -d
2

I had to do

cat /etc/fedora-release
0

Ahh answer to my own question..

cat /etc/issue

1
  • 1
    this won't be a reliable way of checking for the server version because any sysadmin can modify the contents of that file. I modify the /etc/issue and /etc/issue.net files to display the company name and legal notice (and explicitly remove the distro name & version info)(
    – Roy Rico
    Oct 5, 2009 at 23:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .