Find Linux / UNIX Kernel Version

by Vivek Gite on January 2, 2008 · 12 comments

Q. How do I find out what kernel version I am currently running under Debian Linux or any other Linux distribution using a shell prompt?

A. Use uname command which print certain system information such as:
=> Kernel version and name
=> Print the machine hardware name
=> print the processor type
=> print the operating system etc

This command works under all Linux distroubtions and other UNIX like operating systems such as FreeBSD, OpenBSD, Solaris, HP UX etc. Type the following command to see running kernel version:
$ uname -r
Output:

2.6.22-14-generic

Where,

  • 2 : Kernel version
  • 6 : The major revision of the kernel
  • 22 : The minor revision of the kernel
  • 14 : Immediate fixing / bug fixing for critical error
  • generic : Distribution specific sting. For example, Redhat appends string such as EL5 to indicate RHEL 5 kernel.

Another common usage:
$ uname -mrsn
Output:

Linux moon.nixcraft.in 2.6.18-53.1.4.el5 x86_64

/proc/version file

You can also obtain kernel version from /proc/version file:
$ less /proc/version
$ more /proc/version
$ cat /proc/version

Output:

Linux version 2.6.18-53.1.4.el5 (brewbuilder@hs20-bc2-3.build.redhat.com) (gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)) #1 SMP Wed Nov 14 10:37:27 EST 2007

Package management tools

You can list all installed kernel and its version with the following command under RHEL / CentOS / Suse / Fedora Linux :
$ rpm -q kernel
Output:

kernel-2.6.18-53.el5
kernel-2.6.18-53.1.4.el5

If you are using Debian / Ubuntu, try:
$ dpkg --list | grep linux-image
Output:

ii  linux-image                            2.6.22.14.21                         Generic Linux kernel image.
rc  linux-image-2.6.20-15-generic          2.6.20-15.27                         Linux kernel image for version 2.6.20 on x86/
ii  linux-image-2.6.20-16-generic          2.6.20-16.32                         Linux kernel image for version 2.6.20 on x86/
ii  linux-image-2.6.22-14-generic          2.6.22-14.47                         Linux kernel image for version 2.6.22 on x86/
ii  linux-image-generic                    2.6.22.14.21                         Generic Linux kernel image

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 12 comments… read them below or add one }

1 Bhargav January 8, 2008

In Solaris uname -r will give you the solaris release level.
some other usefull options with uname are

uname -s [Operating system]
SunOS

uname -r [Release version]
5.8

uname -v
Generic_117350-27[OS version]

uname -a
SunOS hostname 5.8 Generic_117350-27 sun4u sparc

the last two words describes h/w name and processor respctl[equivalent to -m and -p),

Reply

2 Mohit January 29, 2008

I log on to different RedHat based servers, Can you please update on how to differentiate between Centos, RedHat, Oracle Linux (i.e. RedHat based distributions) sitting remotely.

# uname -a (doesn’t help)
# cat /etc/redhat-relaese (its changed to RedHat as some softwares don’t get installed otherwise.

Thanks
Mohit

Reply

3 Krishna February 20, 2008

Quite useful for beginners and mediocre persons.

Reply

4 snehaliteng September 27, 2008

i need linux fonts

Reply

5 Sourav Mohanty May 27, 2009

Thnksssss

Reply

6 Robbie September 3, 2009

cat /etc/redhat-release
this will give you redh hat version or centos version

Reply

7 Arif May 14, 2010

$ cat /etc/redhat-release

this command return the Centos version

Thanks!

Reply

8 Phil October 5, 2010

Newbie here….kind of got thrown in Linux admin for Centos at work due to staff reduction. Confused about something (well lots of things, but can’t seem to find the answer to this particular question).

[root@xxx ~]# rpm -qa kernel
kernel-2.6.9-89.0.15.EL
kernel-2.6.9-89.0.19.EL
kernel-2.6.9-89.0.28.EL
kernel-2.6.9-89.0.29.EL
kernel-2.6.9-78.0.22.EL
kernel-2.6.9-89.0.11.EL
kernel-2.6.9-89.0.16.EL
kernel-2.6.9-89.0.23.EL
kernel-2.6.9-89.0.25.EL
kernel-2.6.9-89.29.1.EL
kernel-2.6.9-78.0.5.EL
kernel-2.6.9-78.0.8.EL
kernel-2.6.9-78.0.13.EL
kernel-2.6.9-89.0.18.EL

[root@xxx ~]# uname -a
Linux xxx 2.6.9-78.0.22.EL #1 Thu Apr 30 19:03:25 EDT 2009 i686 athlon i386 GNU/Linux

Why does rpm -qa show kernel-2.6.9-89.0.xxxxx installed but uname -a shows 2.6.9-78.00.22.EL?

I know this probably really stupid question – sorry :(

TIA.

Reply

9 Nitin February 8, 2011

Send me all shell and kernel cammond of linux or unix

Reply

10 AMukh February 23, 2011

Life is so easy huh? :)

Send me all the words in the english language and their uses ( I dont claim that this line is original ;) )

Reply

11 Lawrence April 5, 2011

THANKYOU!

Reply

12 hameed October 27, 2011

Thank you very much all friend

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 11 + 2 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: