How to check CentOS version via command line?

by Stephen on October 22, 2009 · 24 comments

in CentOS

Via command line, type this:

cat /etc/redhat-release

To safely upgrade CentOS to the latest version, type this:

yum update

{ 24 comments… read them below or add one }

amit joshi January 5, 2012 at 3:02 am

helpful

Reply

S February 6, 2012 at 9:42 am

I disagree. the cat /etc/redhat-release does nothing on Centos.

Reply

Anon February 7, 2012 at 10:16 pm

It works just fine.

Reply

doesn't work on centos April 5, 2012 at 3:40 pm

No it doesn’t. /etc/redhat-release doesn’t exist on centos.

Reply

Stephen April 5, 2012 at 4:02 pm

Works just fine for me:

root@host [~]# cat /etc/redhat-release 
CentOS release 5.8 (Final)

Reply

anurag July 23, 2014 at 6:11 am

Its working fine and absolutely right,
Thanks

Neamul Haque October 3, 2013 at 3:40 am

It works fine.

Reply

Chris March 21, 2012 at 6:06 pm

Pefect!

Reply

Ron March 21, 2012 at 11:12 pm

works great thanks

Reply

Sunil Hankare June 9, 2012 at 4:13 am

cat /etc/*release*

Reply

Sunil Hankare June 9, 2012 at 4:15 am

lsb_release -a

Reply

Jeet October 25, 2012 at 5:00 am

Its not relevant to CentOS, that is for Ubuntu 😉

Reply

Icub July 17, 2013 at 4:58 pm

it’s work for my centos :/

Reply

Matli Digital December 7, 2012 at 1:32 am

Hi,

Thank you, its working fine on CentOS 5.6 (Final). its showing me exactly version. as well I started the Updates process with the “yum update” commands.

Thanks

Reply

Si December 19, 2012 at 9:40 am

Thanks alot, it works fine for me.

Reply

Marwan April 14, 2013 at 10:26 pm

Works. Thank You.

Reply

vachana March 12, 2014 at 6:03 am

Works, thanks….

Reply

Chankey Pathak June 4, 2014 at 3:27 am

Thanks. I wonder why cat /etc/redhat-release works and cat /etc/centos-release doesn’t on my CentOS?

Reply

Peter July 30, 2014 at 5:20 pm

I know I have CentOS release 5.1 installed, but the command: cat/etc/redhat-release returns the following;

CentOS release 5 (final)

This command works better for me: rpm -q centos-release. It returns

centos-release-5-1-0-el5.centos.1

Reply

Alan January 15, 2015 at 9:29 am

Thanks! Was trying to find if it was 32bit or 64bit and your query worked!!! Thanks :)

Reply

Ace April 13, 2015 at 5:00 pm

Or the fact that RPM is RedHat’s Package Manager

Reply

Chandni July 14, 2015 at 10:57 am

It Works fine. Thank You :)

Reply

Akhil October 9, 2015 at 12:52 am

Its really helpful thanks :) :)

Reply

natong February 18, 2016 at 12:55 pm

cat /etc/*release
cat /etc/*version
lsb_release -d
cat /etc/lsb_release
cat /etc/issue*

uname -a
uname -i (i386 or x86_64)
arch (i386 or x86_64)
getconf LONG_BIT (32 or 64)

Reply

Leave a Comment

Previous post:

Next post: