uname
Command in Linux
Summary
The uname
command in Linux prints system information such as kernel name, version, machine hardware name, and operating system.
Introduction
The uname
command is a simple yet powerful utility for displaying system information on Unix-like operating systems. It provides a concise way to determine details about the kernel and hardware you're running. It's invaluable for scripting, troubleshooting, and simply understanding your system environment.
Use case and Examples
Display the Kernel Name
This displays the name of the operating system kernel. Typically, it will output "Linux".Display the Kernel Release
This shows the kernel release version, such as "5.15.0-94-generic".Display the Kernel Version
This displays the kernel version, which provides more detailed information about the kernel build.Display Machine Hardware Name
This shows the machine hardware name (architecture), often something like "x86_64".Display the Operating System Name
This displays the operating system name, which is usually "GNU/Linux".Display All Information
This is the most commonly used form and displays all available information, including kernel name, network node hostname, kernel release, kernel version, machine hardware name, and operating system.Commonly used flags
Flag | Description | Example |
---|---|---|
-s | Prints the kernel name. | uname -s |
-r | Prints the kernel release. | uname -r |
-v | Prints the kernel version. | uname -v |
-m | Prints the machine hardware name. | uname -m |
-o | Prints the operating system name. | uname -o |
-a | Prints all information. | uname -a |
-n | Prints the network node hostname. | uname -n |
--help | Display help information and exit. | uname --help |
--version | Output version information and exit. | uname --version |