Method Name:
os.ctermid()
Method Signature:
os.ctermid()
Method Overview:
- The method ctermid() of the os module in Python returns the filename associated with the controlling terminal of the process.
- A controlling terminal could be any POSIX terminal, which controls a set of processes, grouped as a session on the host system. Example: A physical ASCII asynchronous terminal, like a VT-100.
Example:
import os
# Get the filename associated with the controlling terminal of the process print("Filename corresponding to the controlling terminal:") print(os.ctermid()) |
Output:
Filename corresponding to the controlling terminal: /dev/tty |
As per output, the path name or the special file that represents the controlling terminal of this process is /dev/tty.