uname
which kernel is thisuname identifies the running kernel. uname -r gives the kernel version and -m the processor architecture — the two facts needed to pick the right download or driver.
uname describes the kernel; /etc/os-release describes the distribution.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
Kernel name, host name, kernel release, build number and date, and the hardware architecture.
The version that matters for drivers and for known vulnerabilities. Its modules live in /lib/modules under this exact name.
x86_64 is 64-bit Intel or AMD; aarch64 is 64-bit ARM. Software must be downloaded for the matching one.
uname knows nothing about Ubuntu or Fedora. That is in /etc/os-release.
Switches
A switch changes how the command behaves. These are the ones used day to day; man uname lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-a- All: print every field on one line.
-r- The kernel release.
-m- The machine architecture: x86_64, aarch64.
-s- The kernel name. This is the default.
-n- The host name.
-v- The kernel build number and date.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
uname -srKernel name and release together.
hostnamectlKernel, distribution, architecture and hardware model in one report.
lsb_release -aThe distribution’s name, release and codename.
cat /proc/versionThe kernel version with the compiler that built it.
In cybersecurity
The kernel version is what decides which kernel vulnerabilities apply.
After getting a shell, uname -a is run to look up privilege-escalation exploits for that exact kernel. An old kernel is an invitation.
A kernel update takes effect only after a reboot. If uname -r shows an older version than the newest in /boot, the fix is not yet active.
Services that announce the operating system and kernel give that information to anyone who connects. Turn it off where you can.