HomeLanguagesPython | os.ctermid() method

Python | os.ctermid() method

OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.

os.ctermid() method in Python is used to get the filename corresponding to the controlling terminal of the process.

Syntax: os.ctermid()

Parameter: Not required

Return Type: This method returns a string value denoting the filename corresponding to the controlling terminal of the process.

Code : Use of os.ctermid() method




# Python program to explain os.ctermid() method 
  
# importing os module 
import os
  
# Get the filename corresponding 
# to the controlling terminal
# of the process.
filename = os.ctermid()
  
  
# Print the filename corresponding 
# to the controlling terminal
# of the process.
print(filename)


Output:

/dev/tty
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32548 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6922 POSTS0 COMMENTS
Nicole Veronica
12039 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12144 POSTS0 COMMENTS
Shaida Kate Naidoo
7059 POSTS0 COMMENTS
Ted Musemwa
7300 POSTS0 COMMENTS
Thapelo Manthata
7016 POSTS0 COMMENTS
Umr Jansen
7005 POSTS0 COMMENTS