What command displays Ubuntu kernel version?

Checking your system’s kernel version is a fundamental task for troubleshooting, installing hardware drivers, or ensuring your OS has the latest security patches. This article provides a quick overview of the primary commands used to find the running kernel version in Ubuntu, explains how to interpret the output, and covers alternative methods for viewing more detailed system information.

The Standard Method: The uname Command

The most common, reliable, and universally available command to check the kernel version on Ubuntu is uname. By appending the -r flag, the terminal will print the exact release version of the currently running kernel.

To use this method, open your terminal (Ctrl + Alt + T) and run:

uname -r

Understanding the Output

When you run the command, you will see a string of numbers and letters. For example, an output might look like this:

6.8.0-35-generic

Alternative Commands for More Information

If you need more details beyond just the kernel release number, Ubuntu offers several other built-in utilities.

1. The uname -a Command

If you want to see the entire system architecture, the build date of the kernel, and the operating system name all at once, use the all flag:

uname -a

2. The hostnamectl Command

On modern versions of Ubuntu, the hostnamectl command provides a clean, easy-to-read summary of your system’s configuration, including the operating system version, architecture, and the Linux kernel version.

hostnamectl

Look for the line that says Kernel: in the printed output.

3. Reading the /proc/version File

Since Linux treats almost everything as a file, you can directly read the virtual file that stores the kernel information using the cat command:

cat /proc/version

This fetches data directly from the compilation process, showing the exact version of the compiler (GCC) used to build your specific kernel alongside the kernel version itself.