Check OS And Kernel Version

February 16, 2006

On most (any?) Linux or Unix system, you should be able to check which operating system it is running by using:


[root@humandoing root]# uname
Linux

This of course can be great when used in a shell script and you need to perform different actions depending on the operating system that the script is being executed on.

Or if you want the kernel version


[root@humandoing root]# uname -r
2.4.27rimu1-3um

If you want to get really crazy:


[root@humandoing root]# uname -a
Linux humandoing.net 2.4.27rimu1-3um #1 Thu Sep 9 02:48:08 UTC 2004 i686 i686 i386 GNU/Linux