Python | os.uname() method

os.uname() method in python is used to get information about current operating system. This method returns information like name, release and version of current operating system, name of machine on network and hardware identifier in the form of attributes of a tuple-like object.

Syntax: os.uname()

Parameters: Not required

Return Type: This method returns a tuple-like object which has five attributes:

  • sysname – operating system name
  • nodename – name of machine on network (implementation-defined)
  • release – operating system release
  • version – operating system version
  • machine – hardware identifier

Code #1: use of os.uname() method





# Python program to explain os.uname() method 
# importing os module 
import os
# Get the information of current
# operating system
os_info = os.uname()
# print the information



posix.uname_result(sysname='Linux', nodename='pppContainer', release='4.4.0-1075-aws', 
version='#85-Ubuntu SMP Thu Jan 17 17:15:12 UTC 2019', machine='x86_64')

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

self motivated and passionate programmer

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.