uname – print system information

uname prints system information including kernel name, version, and architecture.
Synopsis
uname [OPTIONS]
Common Options
| Option | Description |
|---|---|
-a | All information |
-s | Kernel name |
-n | Network hostname |
-r | Kernel release |
-v | Kernel version |
-m | Machine hardware |
-p | Processor type |
-o | Operating system |
Examples
All information
$ uname -a
Linux server 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux
Kernel name
$ uname -s
Linux
Kernel version
$ uname -r
5.15.0-91-generic
Architecture
$ uname -m
x86_64
Operating system
$ uname -o
GNU/Linux
Common Patterns
Check if Linux or macOS
if [ "$(uname -s)" = "Linux" ]; then
echo "Running on Linux"
elif [ "$(uname -s)" = "Darwin" ]; then
echo "Running on macOS"
fi
Check architecture
$ uname -m
x86_64 # 64-bit Intel/AMD
aarch64 # 64-bit ARM
armv7l # 32-bit ARM
More Detailed Info
# Linux distribution
$ cat /etc/os-release
$ lsb_release -a
# macOS version
$ sw_vers
# Full system info
$ hostnamectl # systemd systems
See Also
Related Commands
- hostname — Show/set hostname
- lsb_release — Linux distribution info
- hostnamectl — systemd host info






