Find out my Linux distribution name and version

by Vivek Gite · 11 comments

Q. How do I find out what version of Linux distribution I'm using from the shell prompt?

A. To find out what version of Linux (distro) you are running, enter the following command at the shell prompt:
$ cat /etc/*-release

Output on RHEL 5

Red Hat Enterprise Linux Server release 5 (Tikanga)

Output on Ubuntu 7.10

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 11 comments… read them below or add one }

1 nitin 11.04.07 at 4:07 pm

But how to find version of other unix systems like FreeBSD. cat /etc/*-release won’t give it

2 al 11.06.07 at 11:25 am

This isn’t exactly a general solution. It assumes the distribution supports some LSB stuff, I think.
For debian and slackware, one could try:

$ cat /etc/*version

On debian stable, lsb-release exists, but just isn’t in /etc/. There is an lsb-release package, and you can run:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 4.0r1 (etch)
Release: 4.0r1
Codename: etch

By the way, lsb_release -a also works on the older Ubuntu version I have.

3 Richard Navarrete 03.24.08 at 5:48 pm

You can also cat version in proc…


:; cd /proc
;; cat version
Linux version 2.6.9-42.0.3.ELsmp (brewbuilder@hs20-bc1-7.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 SMP Mon Sep 25 17:28:02 EDT 2006

4 Kamal 09.17.08 at 2:12 pm

Thanks Richard,
cat /proc/version worked for me..

5 Dennisq Quek 02.05.09 at 6:58 am

Thanks alot ! all commands gave some good info about my sys.

And “cat /etc/issue” as well, for my ubuntu 8

6 starioshka_Prokol 03.16.09 at 6:29 pm

thanx richy!!!it works

7 scottavian 10.12.09 at 11:04 pm

Thanks for the quick command. Worked perfectly.

8 maxx 01.22.10 at 3:45 am

hi guys,
can this kind of file which contains the version info be modified? for example when I want to remaster Ubuntu to new name with my name: Maxx

do we just to modify a file? or what should we do?

thanks in advance!

9 gomathi 01.22.10 at 6:07 am

hai ,
i read ur information for linux.but, i want “what r the different versions available in linux”.please give ans immediately

10 Elambarithi 02.09.10 at 9:36 am

Please specify the which Linux ? Redhat or else….

11 Daniel 02.21.10 at 1:42 pm

Also try

uname -a

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All