uname(1)
Print system information like kernel name, version, hardware platform, and hostname.
Synopsis
uname [OPTION]...Description
uname displays information about the system hardware and software. Without options, it prints only the kernel name (Linux). Combined with flags, it shows kernel version, machine type, processor architecture, operating system, and hostname.
This is useful for shell scripts that need to adapt behavior based on the running system, and for quickly checking system details in troubleshooting.
Common options
| Flag | What it does |
|---|---|
-a, --all | print all information (kernel name, version, machine, processor, hardware platform, OS) |
-s, --kernel-name | print the kernel name (default; usually 'Linux') |
-n, --nodename | print the network hostname |
-r, --kernel-release | print the kernel release version (e.g., 5.15.0-56-generic) |
-v, --kernel-version | print the kernel version (build info, compiler details) |
-m, --machine | print the hardware machine type (e.g., x86_64, aarch64) |
-p, --processor | print the processor type (often unknown on some systems) |
-i, --hardware-platform | print the hardware platform identifier |
-o, --operating-system | print the operating system name (usually GNU/Linux) |
Examples
Print just the kernel name, typically 'Linux'
unamePrint all system information: kernel name, hostname, release, version, machine, and OS
uname -aDisplay only the kernel release version (useful for checking if you need to update or recompile)
uname -rShow the hardware architecture (e.g., x86_64 for 64-bit Intel, aarch64 for ARM)
uname -mPrint the system hostname (same as the `hostname` command)
uname -nUse uname in a shell script to check if running on Linux before executing OS-specific code
if [ "$(uname)" = "Linux" ]; then echo OK; fiShow detailed kernel build information and timestamp
uname -v