Pseudo terminal devices (ptys)

Updated: May 06, 2022

Pseudo terminals are managed by the devc-pty driver.

Command-line arguments to devc-pty specify the number of pseudo terminals to create.

A pseudo terminal (pty) is a pair of character devices: a master device and a slave device. The slave device provides an interface identical to that of a tty device as defined by POSIX. However, while other tty devices represent hardware devices, the slave device instead has another process manipulating it through the master half of the pseudo terminal. That is, anything written on the master device is given to the slave device as input; anything written on the slave device is presented as input to the master device. As a result, pseudo-ttys can be used to connect processes that would otherwise expect to be communicating with a character device.

Figure 1. Pseudo-ttys.

Ptys are routinely used to create pseudo-terminal interfaces for programs such as telnet, which uses TCP/IP to provide a terminal session to a remote system.