Swiftorial Logo
Home
Swift Lessons
Tutorials
Learn More
Career
Resources

Using uname - System Information

Introduction

The uname command is used in Unix and Unix-like operating systems to print system information. It can display information such as the operating system name, the machine hardware name, the processor type, and more. This command is very useful for system administrators when troubleshooting or managing systems.

Basic Usage

The basic usage of the uname command without any options prints the operating system name.

uname
Linux

Commonly Used Options

The uname command has several options that allow you to display specific system information:

  • -a: Prints all system information.
  • -s: Prints the kernel name.
  • -n: Prints the network node hostname.
  • -r: Prints the kernel release.
  • -v: Prints the kernel version.
  • -m: Prints the machine hardware name.
  • -p: Prints the processor type (if known).
  • -i: Prints the hardware platform (if known).
  • -o: Prints the operating system.

Examples

Print All System Information

Use the -a option to print all available system information.

uname -a
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

Print Kernel Name

Use the -s option to print the kernel name.

uname -s
Linux

Print Network Node Hostname

Use the -n option to print the network node hostname.

uname -n
hostname

Print Kernel Release

Use the -r option to print the kernel release.

uname -r
5.4.0-42-generic

Print Kernel Version

Use the -v option to print the kernel version.

uname -v
#46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020

Print Machine Hardware Name

Use the -m option to print the machine hardware name.

uname -m
x86_64

Print Processor Type

Use the -p option to print the processor type.

uname -p
x86_64

Print Hardware Platform

Use the -i option to print the hardware platform.

uname -i
x86_64

Print Operating System

Use the -o option to print the operating system.

uname -o
GNU/Linux

Conclusion

The uname command is a simple yet powerful tool for retrieving system information. Whether you need to find out the kernel version, the hardware platform, or other system details, uname provides a quick and easy way to access this information. By understanding and utilizing the various options available, you can effectively manage and troubleshoot Unix and Unix-like systems.