How do I find out what kernel version I am currently running under Debian Linux or any other Linux distribution using a shell prompt? How do I find out Unix kernel version? How can I find out my Linux / UNIX kernel version using the ssh command?
You need to use the uname command to print certain system information such as:
- Linux Kernel version and name.
- Print the Unix machine hardware name.
- Find out about server processor type.
- Display the operating system and more.
uname command to display the Linux or Unix kernel version
This command works under all Linux distributions and other UNIX-like operating systems such as FreeBSD, OpenBSD, Solaris, HP UX, OS X and friends. Type the following command to see running kernel version:
$ uname -r
Output taken from Linux based system:
- 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 is as follows:
$ uname -mrsn
Output taken from Linux:
Linux moon.nixcraft.in 2.6.18-53.1.4.el5 x86_64
Here is another output from RHEL 8:
Outputs from my OS X Unix desktop
$ uname -a Darwin desktop01 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
Outputs from OpenBSD Unix server
$ uname -mrs OpenBSD 5.4 amd64
How to find the kernel version with /proc/version file (Linux only command)
You can also obtain kernel version from /proc/version file by using cat command as follows:
$ less /proc/version
$ more /proc/version
$ cat /proc/version
Linux version 2.6.18-53.1.4.el5 (email@example.com) (gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)) #1 SMP Wed Nov 14 10:37:27 EST 2007
See how to use uname and other commands to find the kernel version on Linux or Unix-like oses:
Package management tools (Linux only command)
You can list all installed kernel and its version with the following command under RHEL / CentOS / Suse / Fedora Linux :
$ rpm -q kernel
If you are using Debian / Ubuntu, try:
$ dpkg --list | grep linux-image
ii linux-image 18.104.22.168.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 22.214.171.124.21 Generic Linux kernel image