$linuxjunkies
>

uname(1)

Print system information like kernel name, version, hardware platform, and hostname.

UbuntuDebianFedoraArch

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

FlagWhat it does
-a, --allprint all information (kernel name, version, machine, processor, hardware platform, OS)
-s, --kernel-nameprint the kernel name (default; usually 'Linux')
-n, --nodenameprint the network hostname
-r, --kernel-releaseprint the kernel release version (e.g., 5.15.0-56-generic)
-v, --kernel-versionprint the kernel version (build info, compiler details)
-m, --machineprint the hardware machine type (e.g., x86_64, aarch64)
-p, --processorprint the processor type (often unknown on some systems)
-i, --hardware-platformprint the hardware platform identifier
-o, --operating-systemprint the operating system name (usually GNU/Linux)

Examples

Print just the kernel name, typically 'Linux'

uname

Print all system information: kernel name, hostname, release, version, machine, and OS

uname -a

Display only the kernel release version (useful for checking if you need to update or recompile)

uname -r

Show the hardware architecture (e.g., x86_64 for 64-bit Intel, aarch64 for ARM)

uname -m

Print the system hostname (same as the `hostname` command)

uname -n

Use uname in a shell script to check if running on Linux before executing OS-specific code

if [ "$(uname)" = "Linux" ]; then echo OK; fi

Show detailed kernel build information and timestamp

uname -v

Related commands