Quick take: The uname command prints system information. uname -a shows everything — kernel name, version, architecture, and hostname — while uname -r shows just the kernel release, which you often need when installing drivers or modules.
Introduction
The uname command (unix name) reports basic information about the system's kernel and hardware. It is the quickest way to check which kernel version is running, what architecture the machine is, and other low-level details — information you frequently need before installing kernel modules, drivers, or architecture-specific software.
This guide covers the individual pieces of information uname can show and the combined -a view.
Syntax
The basic syntax of the uname command is:
uname [OPTIONS]Common Options and Parameters
The most useful options and parameters for the uname command:
| Option | Description |
|---|---|
| -a | Print all available information. |
| -s | Kernel name (Linux). |
| -r | Kernel release/version. |
| -v | Kernel build version and date. |
| -m | Machine hardware architecture (x86_64, aarch64). |
| -n | Network node hostname. |
| -o | Operating system (GNU/Linux). |
Practical Examples
Real uname commands you can run today:
# Show everything
uname -a
# Kernel release (for drivers/modules)
uname -r
# Hardware architecture
uname -m
# Just the kernel name
uname -s
# Hostname
uname -nTips and Best Practices
uname -rgives the running kernel version — exactly what you need when building modules or installing the matchinglinux-headerspackage.uname -mtells you the architecture:x86_64for 64-bit Intel/AMD,aarch64for 64-bit ARM.- For distribution name and version (Ubuntu 26.04, etc.), use
lsb_release -aor read/etc/os-release— uname reports the kernel, not the distro.
Final Thoughts
uname is the fast way to learn what kernel and architecture a machine runs. Remember -a for the full picture, -r for the kernel release needed when installing modules, and -m for the architecture. For the distribution name and release, pair it with lsb_release -a or /etc/os-release.
FAQ: uname Command in Linux
How do I check my Linux kernel version?+
Run uname -r to print the kernel release, for example 7.0.0-12-generic. uname -a shows it alongside the kernel name, build date, architecture, and hostname.
How do I check if my system is 32 or 64-bit?+
Use uname -m. x86_64 means 64-bit Intel/AMD, aarch64 means 64-bit ARM, and i686 or i386 means 32-bit.
What does uname -a show?+
It prints all information on one line: the kernel name, hostname, kernel release and version, machine architecture, and operating system.
How do I find my Linux distribution version?+
uname reports the kernel, not the distro. Use lsb_release -a or cat /etc/os-release to see the distribution name and version like Ubuntu 26.04.
Why do I need uname -r when installing software?+
Kernel modules and drivers must match the running kernel. uname -r gives that exact version so you can install the matching linux-headers package or build a compatible module.
Need help with Linux servers or infrastructure?
Work directly with Muhammad Irfan Aslam for Linux, Ubuntu, Docker, DevOps, cloud, CI/CD, or infrastructure support.
Hire Me for Support