While troubleshooting a problem with my ethernet card, I've found that the driver I'm currently using may have some issues with old kernel versions. What command can I use to check the kernel version I am currently running ?
7 Answers
You can execute:
uname -r
It will display something like
3.13.0-62-generic
Found on https://askubuntu.com/questions/359574/how-do-i-find-out-the-kernel-version-i-am-running (view that QA to learn other commands you could use)
For Ubuntu
enter the command
# uname -r
will Print the kernel name
# uname -a
Will Print all Information
or else we can check with cat /proc/version
For Redhat and centos
# cat /etc/redhat-release
# lsb_release –a
dmesg | grep Linux
This command reads boot logs as it startup.
Output:
[ 0.000000] Linux version 4.9.0-8-amd64 ([email protected]) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21)
uname -r for exact version of the kernel or uname -a for information in the kernel AND information about your distro.
uname -rv
gives both, revision and version. This works on all UNIX platforms since ~1982, except for AIX (Alien UNIX ;-) because IBM implemented AIX after reading the man pages and confused -r with -v and vice versa ;-)
/etc/redhat-release gives only current version
Red Hat Enterprise Linux Server release 7.2 (Maipo)
To get kernel details in Redhat use /proc/version.
cat /proc/version
Linux version 3.10.0-327.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Oct 29 17:29:29 EDT 2015
OR
uname -a
Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
How do I check the running kernel version?
What you want is known as the kernel release.
Here is how I output the name, release, and version
of the kernel
when running Ubuntu 22.04 (jammy) on WSL2 :
1
$ uname --kernel-name # or uname -s
Linux
$ uname --kernel-release # or uname -r
5.10.16.3-microsoft-standard-WSL2
$ uname --kernel-version # or uname -v
#1 SMP Fri Apr 2 22:23:49 UTC 2021
If you prefer to get it all in one go :
$ uname --all # or uname -a
Linux hp 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Reference
1 It so happens that the output is identical when running Debian 11 (bullseye) on WSL2.