🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

uname Command

Beginner System Information man(1)

Print system information (kernel, OS, architecture)

👁 8 views 📅 Updated: Mar 15, 2026
SYNTAX
uname [OPTION]...

What Does uname Do?

uname displays system information including the kernel name, version, architecture, hostname, and operating system. It is the standard way to identify the running system in scripts and documentation.

uname -a shows all available information in one line. Individual flags extract specific pieces: kernel name (-s), hostname (-n), kernel release (-r), kernel version (-v), machine architecture (-m), and operating system (-o).

uname is essential in scripts that need to behave differently on different architectures (x86_64 vs aarch64), kernel versions, or operating systems.

Options & Flags

OptionDescriptionExample
-a Print all system information uname -a
-s Kernel name uname -s
-r Kernel release version uname -r
-m Machine hardware architecture uname -m
-n Network hostname uname -n
-o Operating system uname -o
-v Kernel version (build info) uname -v

Practical Examples

#1 Show all info

Displays complete system identification.
$ uname -a
Output: Linux hostname 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux

#2 Check architecture

Shows hardware architecture (x86_64, aarch64, armv7l, etc.).
$ uname -m
Output: x86_64

#3 Check kernel version

Shows the running kernel version.
$ uname -r
Output: 5.15.0-91-generic

#4 Check OS

Shows the operating system name.
$ uname -o
Output: GNU/Linux

#5 Conditional in script

Architecture check for conditional installation.
$ [[ $(uname -m) == "x86_64" ]] && echo "64-bit" || echo "Other"
Output: 64-bit

#6 Get hostname

Shows the system hostname.
$ uname -n
Output: webserver01

Tips & Best Practices

Check architecture for downloads: Use uname -m before downloading binaries. x86_64 = 64-bit Intel/AMD, aarch64 = 64-bit ARM, armv7l = 32-bit ARM.
More detailed info: For OS distribution details, use cat /etc/os-release or lsb_release -a instead of uname.
Container kernel: In containers, uname shows the HOST kernel, not the container OS. Use /etc/os-release for container OS info.

Frequently Asked Questions

How do I check my Linux version?
uname -r shows kernel version. cat /etc/os-release shows distribution and version (Ubuntu 22.04, etc.).
How do I check if my system is 64-bit?
uname -m returns x86_64 for 64-bit Intel/AMD, aarch64 for 64-bit ARM.
What kernel am I running?
uname -r shows the kernel release (e.g., 5.15.0-91-generic). uname -v shows the build date.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →