What are pseudo terminals (pty/tty)?

This might be really basic question but I want to understand it thoroughly.

  1. What is a pseudo terminal? (tty/pty)
  2. Why do we need them? How they got introduced and what was the need for it?
  3. Are they outdated? Do we not need them anymore? Is there anything that replaced them?
  4. Any useful use-case?

What I did:

  1. Read man pages – got some info but not the exact picture.
  2. Tried to read on them from Unix Network Programming by Richard Stevens.
    Got some info but not the why? part.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

  1. A device that has the functions of a physical terminal without actually being one. Created by terminal emulators such as xterm. More detail is in the manpage pty(7).
  2. Traditionally, UNIX has a concept of a controlling terminal for a group of processes, and many I/O functions are built with terminals in mind. Pseudoterminals handle, for example, some control characters like ^C.
  3. They are not outdated and are used in many programs, including ssh.
  4. ssh.

Method 2

The answer is in the name — “Pseudo” meaning “not genuine but having the appearance of”.

With the first terminals, there was always a piece of hardware attached with associated device, be it display hardware or a serial port.

With xwindows, telnet and ssh, there came a need for software “Pseudo devices” to do the job of standing in for display hardware. They are “Pseudo Terminals” … software that emulates Terminal hardware, handling input and output in the same way a physical device would so that the software connected is not aware there’s not a real device attached.

Method 3

Pseudo-terminals are emulators for serial lines. They provide endpoints for telnet, ssh, and xterm shells.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x