The Linux kernel version is uname -r - that single command prints the running kernel release. uname -a shows everything (kernel, hostname, architecture, build date), and hostnamectl includes the kernel in its summary. The team that knows which kernel they are running can match it against CVE lists and decide when to reboot for a kernel update.
Table of contents
- uname: the canonical answer
- hostnamectl: full summary
- /proc/version: kernel build info
- /proc/sys/kernel/osrelease and version
- List installed kernels
- FAQ
uname: the canonical answer
uname -r
# Output: 5.15.0-89-generic
uname -a
# Output: Linux webserver 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 19:43:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
uname -r is the running kernel release. uname -v is the build version (kernel commit hash on custom builds). uname -m is the architecture (x86_64, aarch64, armv7l).
hostnamectl: full summary
hostnamectl
Includes:
Static hostname: webserver
Icon name: computer-vm
Chassis: vm
Machine ID: ...
Boot ID: ...
Virtualization: kvm
Operating System: Ubuntu 22.04.3 LTS
Kernel: Linux 5.15.0-89-generic
Architecture: x86-64
The team that uses hostnamectl for a quick OS-level summary gets kernel, distro, and architecture in one command.
/proc/version: kernel build info
cat /proc/version
# Output: Linux version 5.15.0-89-generic (buildd@lcy02-amd64-019) (gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) ...)
The file shows the build user, compiler version, and the build date. The team that audits kernel builds across many servers uses this to verify all servers are on the same compile of the same kernel.
/proc/sys/kernel/osrelease and version
cat /proc/sys/kernel/osrelease
# 5.15.0-89-generic
cat /proc/sys/kernel/version
# #99-Ubuntu SMP Mon Oct 30 19:43:39 UTC 2023
These two virtual files have the same info as uname -r and uname -v respectively, but are scriptable.
List installed kernels
# Debian/Ubuntu
dpkg --list | grep linux-image
# RHEL family
rpm -qa kernel
The team that has multiple kernels installed can boot into an older one from GRUB. The team that has only the running kernel has nothing to fall back to - keep at least one older kernel installed during major upgrades.
FAQ
What does 5.15.0-89-generic mean?
5.15.0 is the upstream kernel version (Linus’s tree). 89 is the Ubuntu patch count (Ubuntu-specific patches on top of upstream). generic is the kernel flavor (Ubuntu’s general-purpose kernel; others include lowlatency, aws, azure).
How do I update the kernel?
Debian/Ubuntu: sudo apt update && sudo apt upgrade (or sudo apt install linux-image-generic for just the kernel). RHEL family: sudo yum update kernel and reboot. The team that uses unattended-upgrades on Ubuntu has automatic security kernel updates; the team that does manual updates should reboot on security kernel updates within a few days.
Do I need to reboot after a kernel update?
Yes. The running kernel cannot be replaced while the system is running (it’s mapped into memory and locked). The team that uses live patching (Ubuntu Livepatch, kpatch, kGraft) can apply security fixes without rebooting - the patch is loaded as a kernel module.
What is the latest stable kernel?
kernel.org is the canonical source. As of writing, the latest stable is in the 6.x series. The team that tracks the upstream stable kernel version knows when to upgrade from the LTS kernel that ships with their distro.
Can I tell which kernel a core dump is from?
file core.dump or read the dump’s notes section. The kernel version is recorded in the ELF notes. The team that debugs core dumps across multiple kernel versions uses this to ensure the dump matches the running kernel.
If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.
Useful related references: