Linux uname Command: Print System Information

Before you install a kernel module or download the right build of a package, you need to know which kernel release and architecture the machine is actually running. uname answers both in one short command, reading the kernel name, release, version, machine architecture, and hostname directly from the kernel.
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 type (non-portable, often unknown) |
-i | --hardware-platform | Print the hardware platform (non-portable, often unknown) |
-o | --operating-system | Print the operating system name (GNU/Linux on Linux) |
-a | --all | Print all of the above in the order -snrvmpio |
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)
On systems where the processor type or hardware platform cannot be determined, uname reports them as unknown and leaves them out of the -a output.
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. On Linux, this reads the same kernel hostname as the hostname command. The uname -n command is read-only, while many hostname implementations can also change the name when run with sufficient privileges:
uname -ndev.linuxize.comPractical Uses
Detect System Architecture in a Script
A common use of uname is to select the correct package or binary for a system. The -m option prints the machine hardware name:
uname -mOn a 64-bit x86 system:
x86_64On a 32-bit x86 system:
i686You can use this value inside a shell script to handle common Linux architectures explicitly:
ARCH=$(uname -m)
case "$ARCH" in
x86_64)
echo "Use the x86_64 build"
;;
aarch64)
echo "Use the ARM64 build"
;;
i?86)
echo "Use the 32-bit x86 build"
;;
armv6l|armv7l)
echo "Use the 32-bit ARM build"
;;
*)
echo "Unsupported architecture: $ARCH" >&2
exit 1
;;
esacThis example stops on an unrecognized value instead of selecting the wrong build. Add another case when the software supports architectures such as ppc64le or s390x.
Check the Operating System Name
To print only the operating system name:
uname -oGNU/LinuxKeep in mind that -o is a GNU extension. The BSD version of uname that ships with macOS does not support it, so in scripts that must run on both systems use -s instead, which prints Linux or Darwin.
For more detailed distribution information (name, version, codename), use lsb_release
instead of uname.
Related Commands
uname reads its values from the kernel, so it is fast but limited to what the kernel exposes. A few other commands fill the gaps.
The kernel release is also readable straight from the proc filesystem, along with the compiler used to build it:
cat /proc/versionLinux version 6.8.0-51-generic (buildd@lcy02-amd64-021) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024That is the same release string uname -r returns, wrapped in build details you rarely need but that help when reporting a kernel bug.
For a formatted summary of the hostname, operating system, and kernel in one block, hostnamectl
is easier to read than uname -a on systemd-based systems.
The arch command is a shorthand for uname -m and prints only the machine hardware name:
archx86_64When you need processor details beyond the architecture string, such as the core count, model name, or cache sizes, see the guide on getting CPU information .
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 |
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.
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