April 18, 2014

How to check your CentOS version

Most Red Hat-based distributions, like CentOS, should have a file called redhat-release which will contain the CentOS version.

# cat /etc/redhat-release
CentOS release 5.5 (Final)

or

# rpm -q centos-release
centos-release-5-5.el5.centos.1

and finally

# lsb_release -i
Distributor ID: CentOS
# lsb_release -r
Release: 5.5
# lsb_release -d
Description: CentOS release 5.5 (Final)

  • John R. Dennison

    /etc/redhat-release is a standard text file that is subject to easy change by admins via their text editor of choice. Proper method for determining CentOS version is:

    rpm -q centos-release

    We in many cases will also request output from “uname -a” to further identify the kernel in use to see if it is a native CentOS kernel or rather a 3rd party kernel provided by a hosting provider (OpenVZ is a common example of such a non-standard kernel).

  • Anonymous

    Thanks John – I have added your method to the tutorial

  • Jacco

    $ lsb_release -i
    Distributor ID: CentOS
    $ lsb_release -r
    Release: 5.5
    $ lsb_release -d
    Description: CentOS release 5.5 (Final)

  • Doru Barit

    Or just use : cat /etc/issue
    CentOS Linux release 6.0 (Final)
    Kernel r on an m
    Work on all versions: 4,5 and 6.

  • http://www.weblayers.in Harsh Kotak

    I wish to update centos to v5.5 currently running on v5, so if i go to console and type “#yum update” will it ask me which version would i like to update to or will it directly update to centos v6? Please suggest me a method to update centos to v5.5 and not v6. Waiting for your reply. Regards

  • Anonymous

    If you run yum update it will only update you to the latest version under the major release which is CentOS 5.7

  • http://www.trailermusicvibe.blogspot.com/ Leighton

    Thanks this worked

  • Eduardo Bergavera

    Thanks. That helped.