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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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
print(os_info) 

chevron_right


Output:

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')


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 contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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 contribute@geeksforgeeks.org to report any issue with the above content.