uname() method of os module in Python

The python method os.uname() returns system Information including the details of the operating system kernel. The output of the Python example prints the macOS information including the kernel version along with the network node name.

Os Updated 15 Nov 2018 1 min read

Method Name

uname

Method Signature

os.uname()

Return Value

Returns a tuple-like instance of type posix.uname_result which contains named attributes and their values.

Method Overview

  • The method os.uname() returns information on the operating system kernel.
  • The information on the operating system kernel include
    • Name of the operating system
    • Node Name – Implementation defined name of the machine on the network
    • Release – Release number of the Operating System
    • Version – Version number of the Operating System
    • Machine – Hardware Identifier of the machine e.g., x86_64

Example

python
import os

print("System Information:")

print(os.uname())

Output

Output
System Information:

posix.uname_result(sysname='Darwin', nodename='Python-iMac.local', release='14.0.0', version='Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64', machine='x86_64')