Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 6 down vote accepted

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

mojo-jojo david% cat /etc/lsb-release 
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.

share|improve this answer
on centOS 5.3 that file doesn't exist, but the bin directory provides provides lsb_release as a command alternative – Zak Oct 5 '09 at 23:21
lsb_release is not available on Fedora (21 Workstation) base image – ACyclic Mar 25 '15 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]" – Jeremy Hajek Sep 14 '15 at 1:25

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)

share|improve this answer

I had to do

cat /etc/fedora-release
share|improve this answer

Ahh answer to my own question..

cat /etc/issue

share|improve this answer
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/ files to display the company name and legal notice (and explicitly remove the distro name & version info)( – Roy Rico Oct 5 '09 at 23:12

ahh, even better, and *nixwide:

lsb_release -d

share|improve this answer

protected by HopelessN00b Feb 28 at 21:45

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.