Skip to content

uname Command Cheat Sheet

uname (unix name) prints detailed information about the machine and operating system.


Synopsis

uname [OPTION]...

Basic Usage

uname
# Output: Linux
uname -a
# Output: Linux hostname 5.15.0-91-generic #101-Ubuntu SMP ... x86_64 ...

Options Breakdown

Flag Description Example Output
-s Kernel Name Linux
-n Network Node Hostname myserver
-r Kernel Release 5.15.0-91-generic
-v Kernel Version #101-Ubuntu SMP Tue...
-m Machine Hardware x86_64 (or aarch64)
-p Processor Type x86_64 (sometimes unknown)
-i Hardware Platform x86_64 (sometimes unknown)
-o Operating System GNU/Linux

Common Use Cases

Checking Architecture (32 vs 64 bit)

uname -m
- x86_64 = 64-bit - i686 / i386 = 32-bit - aarch64 = ARM 64-bit (Raspberry Pi 4, Apple Silicon)

Checking Kernel for Modules

To install headers matching your kernel:

sudo apt install linux-headers-$(uname -r)

Notes

  • Distro Info: uname does not tell you if you are on Ubuntu, Fedora, or Alpine. Use cat /etc/os-release or hostnamectl for that.