Linux uname Command: Print System Information

uname is a command-line utility that prints basic information about the operating system and system hardware, including the kernel name, version, release, machine architecture, and hostname.
This guide covers all uname options with practical examples, including how to use uname in scripts to detect system architecture.
Syntax
The general syntax of the uname command is:
uname [OPTIONS]...When invoked without any options, uname prints the kernel name:
unameLinuxuname Options
| Option | Long form | Description |
|---|---|---|
-s | --kernel-name | Print the kernel name |
-n | --nodename | Print the system hostname (same output as the hostname command) |
-r | --kernel-release | Print the kernel release |
-v | --kernel-version | Print the kernel version (build timestamp and flags) |
-m | --machine | Print the machine hardware name |
-p | --processor | Print the processor architecture |
-i | --hardware-platform | Print the hardware platform |
-o | --operating-system | Print the operating system name (GNU/Linux on Linux) |
-a | --all | Print all of the above, equivalent to -snrvmo |
Print All System Information
The most common way to use uname is with the -a option to print all available information at once:
uname -aLinux dev.linuxize.com 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/LinuxThe fields in the output appear in the fixed order defined by uname -snrvmpio:
Linux— Kernel name (-s)dev.linuxize.com— Hostname (-n)6.8.0-51-generic— Kernel release (-r)#52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024— Kernel version (-v)x86_64— Machine hardware name (-m)x86_64— Processor architecture (-p)x86_64— Hardware platform (-i)GNU/Linux— Operating system (-o)
Combine Options
Options can be combined to produce only the fields you need. For example, to print the kernel release and machine architecture together:
uname -rm6.8.0-51-generic x86_64The output always follows the fixed -a order regardless of how you order the flags. Both uname -rm and uname -mr produce the same result.
To check the kernel version running on your system:
uname -r6.8.0-51-genericTo print the hostname, use -n. This produces the same result as the hostname command:
uname -ndev.linuxize.comPractical Uses
Detect System Architecture in a Script
A common use of uname is to detect whether a system is 32-bit or 64-bit before installing or compiling software. The -m option prints the machine hardware name:
uname -mOn a 64-bit system:
x86_64On a 32-bit system:
i686You can use this inside a shell script to branch based on architecture:
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
echo "64-bit system detected"
else
echo "32-bit or non-x86 system detected"
fiCheck the Operating System Name
To print only the operating system name:
uname -oGNU/LinuxThis is useful in scripts that may run on multiple platforms, such as Linux and macOS.
For more detailed distribution information (name, version, codename), use lsb_release
instead of uname.
Quick Reference
| Command | Description |
|---|---|
uname | Print kernel name |
uname -a | Print all system information |
uname -r | Print kernel release |
uname -v | Print kernel version (build info) |
uname -n | Print hostname |
uname -m | Print machine hardware name (x86_64, i686, etc.) |
uname -p | Print processor architecture |
uname -o | Print operating system name |
uname -s | Print kernel name (same as no options) |
uname -rm | Print kernel release and machine architecture |
FAQ
What is the difference between uname -r and uname -v?-r prints the kernel release string (e.g., 6.8.0-51-generic), which identifies the kernel version number. -v prints the kernel version string, which contains the build number, compilation flags, and timestamp. For most purposes, -r is the one you want.
What does x86_64 in uname -m mean?x86_64 means the system is running a 64-bit x86 processor. A 32-bit system would show i686 or i386. ARM systems show values like aarch64 (64-bit ARM) or armv7l (32-bit ARM).
How is uname -n different from the hostname command?
They produce the same output — both print the system’s network hostname. uname -n reads the nodename from the kernel, while hostname uses its own lookup. In practice they are interchangeable for reading the hostname.
How do I check which Linux distribution I am running?uname only reports kernel information, not the distribution name or version. To identify the distribution, use lsb_release -a, cat /etc/os-release, or see the check Linux version
guide.
Conclusion
The uname command is a quick way to inspect kernel and hardware details from the command line. Use uname -a to display everything at once, or combine individual flags like -rm to print only the fields you need.
If you have any questions, feel free to leave a comment below.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page