Determine Linux version

Contributor Icon Contributed by qmchenry  
Tag Icon Tagged: Linux  

When visiting a new Linux system, it may not be known which of the many flavors and versions the system is. This recipe describes a couple of techniques for determining the version of Linux running on a host.


The command uname -a will generate output like

Linux poly.tech-recipes.com 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386 GNU/Linux

This can be interpreted as:

kernel name: Linux
hostname: poly.tech-recipes.com
kernel release: 2.6.5-1.358
kernel version: #1 Sat May 8 09:04:50 EDT 2004

The specific distribution information is missing from the uname output. Many distributions put this information in a file in /etc like /etc/redhat-release, /etc/debian_version, /etc/gentoo-release, and so on. For the system described by the uname output above, the file /etc/fedora-release contains the following text:

Fedora Core release 2 (Tettnang)

 

6 Comments -


  1. Miladinoski said on December 26, 2008

    Thanks for the second part of the info :)

  2. reader said on February 20, 2009

    exactly what I was looking for. It’s useful to be able to determine this kind of information for automated scripts that connect to and perform tasks on multiple machines of various flavors, versions and distros.

  3. Lexa Puzikoff said on April 20, 2009

    cat /proc/version
    cat /etc/issue

  4. uellue said on April 20, 2009

    Thx, short and useful info. :-)

  5. Anonymous said on October 8, 2009

    I like this output a lot better than “uname -a”output.
    Ideal for reports/inventory/presentations.

    Thanks a lot!

  6. Anonymous said on February 3, 2010

    It works better than uname -a for me
    cat /proc/version

    I can get more accurate information, correct?

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -