Easy way to tell what linux distribution is installed

Ed Wilts ewilts at ewilts.org
Sun Jul 11 17:09:43 UTC 2004


On Sun, Jul 11, 2004 at 12:54:32PM -0400, Rik van Riel wrote:
> If you restrict yourself to /proc, sure.
> 
> However, a lot of distributions have /etc/<distro>-version
> that can be used to detect what distro you're running on.

The original poster wanted an easy answer.  I don't think there is one.

I assume you meant /etc/<distro>-release since RHEL doesn't even have a
<distro>-version file.

[ewilts at pe400 ewilts]$ cat /etc/redhat-release
Tao Linux release 1 (Mooch Update 2)

[ewilts at pe400 ewilts]$ ls -l /etc/redhat-release
lrwxrwxrwx    1 root     root           11 Jul  3 13:00 /etc/redhat-release -> tao-release

Now you could make the assumption that if /etc/redhat-release exists,
you're on a Red Hat Linux-based system of some kind, and depending on
what you want the answer for, you could be close enough.  Your lawyers
wouldn't be happy if people started saying that Tao Linux was Red Hat
Linux.  If, on the other hand, a human searched for and typed out
/etc/*-release (differentiating lsb-release from redhat-release) to see
if a certain rpm might install, you could be ok.  Programatically, it's
a lot harder.  You may get some of the major distributors, but you'll
certainly miss a lot of the smaller ones.

-- 
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts at ewilts.org
Member #1, Red Hat Community Ambassador Program





More information about the redhat-list mailing list