Cheat Sheet #day54 - uname

Cheat Sheet #day54 - uname

uname Command Cheatsheet

The uname command in Unix/Linux is used to display system information. It provides details about the operating system and the hardware on which it is running.

Syntax

uname [OPTION]...

Common Options

  • -s: Print the kernel name.

  • -n: Print the network node hostname.

  • -r: Print the kernel release.

  • -v: Print the kernel version.

  • -m: Print the machine hardware name.

  • -p: Print the processor type.

  • -i: Print the hardware platform.

  • -o: Print the operating system.

  • -a: Print all available system information.

Examples and Use Cases

Print the Kernel Name

uname -s
  • Outputs the name of the kernel (e.g., Linux).

Print the Network Node Hostname

uname -n
  • Outputs the network node hostname (e.g., hostname).

Print the Kernel Release

uname -r
  • Outputs the kernel release number (e.g., 5.4.0-42-generic).

Print the Kernel Version

uname -v
  • Outputs the kernel version (e.g., #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020).

Print the Machine Hardware Name

uname -m
  • Outputs the machine hardware name (e.g., x86_64).

Print the Processor Type

uname -p
  • Outputs the processor type (e.g., x86_64). Note: may show unknown on some systems.

Print the Hardware Platform

uname -i
  • Outputs the hardware platform (e.g., x86_64). Note: may show unknown on some systems.

Print the Operating System

uname -o
  • Outputs the operating system (e.g., GNU/Linux).

Print All System Information

uname -a
  • Outputs all available system information in a single line:

      Linux hostname 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    

Combining Options

You can combine multiple options to get specific pieces of information together. For example:

Print Kernel Name and Release

uname -sr
  • Outputs the kernel name and release:

      Linux 5.4.0-42-generic
    

Additional Information

  • To get help or see the full list of options, you can use:

      uname --help
    
  • For detailed documentation, refer to the man page by typing:

      man uname
    

This cheatsheet provides a quick reference to the most common usages and options for the uname command. For more detailed information, you can always refer to the uname man page.

Did you find this article valuable?

Support Cloud Tuned by becoming a sponsor. Any amount is appreciated!