uname

Overview

The uname command prints system information including kernel name, network node hostname, kernel release, version, machine hardware name, and operating system.

Syntax

uname [options]

Common Options

Option Description
-a Print all information
-s Print kernel name
-n Print network node hostname
-r Print kernel release
-v Print kernel version
-m Print machine hardware name
-p Print processor type
-i Print hardware platform
-o Print operating system

Key Use Cases

  1. System identification
  2. OS version checking
  3. Architecture detection
  4. Kernel information
  5. Platform verification

Examples with Explanations

Example 1: All Information

uname -a

Display all system information

Example 2: Kernel Version

uname -r

Show kernel release version

Example 3: Machine Hardware

uname -m

Display machine hardware name

Understanding Output

Example output format:

Linux hostname 5.4.0-generic #1-Ubuntu x86_64 GNU/Linux

Components: - Kernel name - Host name - Kernel release - Kernel version - Machine architecture - Operating system

Common Usage Patterns

  1. Check system type:

    uname -s
  2. Get architecture:

    uname -m
  3. Full system info:

    uname -a

Performance Analysis

  • Fast execution
  • Minimal system impact
  • Static information
  • No file system access
  • Lightweight operation

Additional Resources

Use Cases

  1. Script system detection
  2. Compatibility checking
  3. System documentation
  4. Build environment setup
  5. Platform verification

Best Practices

  1. Use -a for complete info
  2. Check specific components
  3. Combine with other commands
  4. Script automation
  5. Regular monitoring