Pages

Tuesday, June 07, 2011

The truth of the kernel

For various reasons I sometimes have to know what Linux kernel I'm using with Ubuntu.  It's easy, but I always forget how, so this is as much for my own use as anything else:

To find your current Linux kernel, at the command prompt:
uname -r (quick, short reply)
uname -a (same with a little more information)
The difference between those two is that -r just tells you the version of the Linux kernel.
l@l:~$ uname -r
2.6.32-21-generic
That's pretty straightforward.  The first two numbers, in this case the 2 and the 6, are major and minor releases.  The third number, 32, is the version.  The fourth number, 21, reflects the back-ports that are incorporated into the kernel.

An rc.x at the end means the version is a release candidate, the last revisions before a version is ready for use.

If you're curious, you can browse through the history of Linux 2.6.x.  Or back to the very beginning.  If you want to how Linux kernel numbering has changed over the years and why it changed, you can read the history, complete with primary documents.

Chances are, you're using an operating system that makes use of the Linux kernel, like Ubuntu, Red Hat, Open SUSE and so forth.  These are sometimes called "flavors" of Linux.  Frankly, I find they all taste the same, but they look and operate a little differently.

By using -a, you'll get a response like this:

l@l:~$ uname -a
Linux l 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC 2010 x86_64 GNU/Linux






Another way to get information about your kernel is by looking at the /proc file.  The command is:
cat /proc/version
The result, will look like this:

l@l:~$ cat /proc/version
Linux version 2.6.32-21-generic (buildd@yellow) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC 2010
What does it all mean?  
  • Linux version 2.6.32-21-generic The complete Linux version.
  • (buildd@yellow) The username and host name of the person who compiled the kernel.  Thanks buildb, home everything's going well at yellow.
  • (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) The version of the compiler buildb used.
  • #32-Ubuntu SMP The type of the kernel (SMP means Symmetric Multi-Processing, which means the kernel makes use of multi-core processing)
  • Fri Apr 16 08:09:38 UTC 2010 The time and day that the kernel was compiled.

No comments: