0
0
Linux-cliHow-ToBeginner · 3 min read

How to Use uname Command in Linux: Syntax and Examples

The uname command in Linux shows system information like the kernel name, version, and hardware details. Use uname -a to display all available system info in one line.
📐

Syntax

The basic syntax of the uname command is:

  • uname [OPTION]

Common options include:

  • -a: Show all system information
  • -s: Show kernel name
  • -r: Show kernel release
  • -m: Show machine hardware name
bash
uname [OPTION]
💻

Example

This example shows how to use uname -a to display all system information in one line.

bash
uname -a
Output
Linux myhostname 5.15.0-70-generic #77-Ubuntu SMP Fri Mar 24 15:09:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
⚠️

Common Pitfalls

One common mistake is running uname without options expecting detailed info; it only shows the kernel name by default. Another is confusing uname -m (machine hardware) with uname -r (kernel release).

bash
uname
uname -m
uname -r
Output
Linux x86_64 5.15.0-70-generic
📊

Quick Reference

OptionDescription
-aShow all system information
-sShow kernel name
-nShow network node hostname
-rShow kernel release
-vShow kernel version
-mShow machine hardware name
-pShow processor type
-iShow hardware platform
-oShow operating system

Key Takeaways

Use uname -a to get complete system information in one command.
Without options, uname shows only the kernel name.
Different options show specific system details like hardware or kernel version.
Remember uname -m is hardware info, not kernel version.
The command helps quickly identify your Linux system details for troubleshooting or scripting.