uname command in Linux
2024-8-8 13:35:26 Author: kalitut.com(查看原文) 阅读量:1 收藏

The uname command in Linux is used to display system information. It provides details about the operating system, kernel version, and other system-specific data. Let’s break down its functionality and provide some examples.

uname command in Linux

Options
Here are some commonly used options with uname:

Short optionsLong optionsmeaning
-a–allDisplays the kernel name (-s), hostname (-n), kernel release number (-r), kernel version (-v), hardware name (-m), CPU (-p, omitted if unknown), hardware platform (-i, omitted if unknown), and OS name (-o), in that order.
-s–kernel-nameShow kernel name (default)
-n–nodenameShow hostname (network node)
-r–kernel-releasePrint the kernel release number
-v–kernel-versionShow kernel version
-m–machineShow hardware name (e.g. x86_64)
-p–processorShow CPU type (or “unknown” if unknown)
-i–hardware-platformShow the hardware platform (or “unknown” if unknown)
-o–operating-systemShow the name of the OS

Examples

Print the Kernel Name:

uname -s

Print the Network Node Hostname:

uname -n
Output
localhost

Print the Kernel Release:

uname -r
Output:
6.6.9-amd64

Print the Kernel Version:

uname -v
Output:
#1 SMP PREEMPT_DYNAMIC Kali 6.6.9-1kali1 (2024-01-08)

Print the Machine Hardware Name:

Print the Processor Type (might be unknown on some systems):

Print the Hardware Platform (might be unknown on some systems):

Print the Operating System:

uname -o
Output:
GNU/Linux

Print All System Information:

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

Explanation of Output

  • Linux: The kernel name.
  • localhost: The network node hostname.
  • 5.4.0-42-generic: The kernel release version.
  • #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020: The kernel version, including build and compiler info.
  • x86_64: The machine hardware name, processor type, and hardware platform (all are the same in this example).
  • GNU/Linux: The operating system name.

Summary

The uname command is a versatile tool to quickly gather system information, particularly useful in scripting and system administration tasks. By using the appropriate options, you can specify exactly what information you need, or use -a to get a comprehensive overview of the system.

Reader Interactions


文章来源: https://kalitut.com/uname-command-in-linux/
如有侵权请联系:admin#unsafe.sh