Pseudoterminal

Pseudoterminals as they are used by script unix command that records user's input for replaying it later.

In some operating systems, including Unix-like systems, a pseudoterminal, pseudotty, or PTY is a pair of pseudo-device endpoints (files) which establish asynchronous, bidirectional communication (IPC) channel (with two ports) between two or more processes.[1][2][3]

One pseudo-device in the pair, the master, provides means by which a terminal emulator or remote login server (e.g. a Telnet, rlogin, or Secure Shell server)[3] process controls the slave. The other pseudo-device, the slave, emulates a hardware serial port device,[1] and is used by terminal-oriented programs such as shells (e.g. bash) as a processes to read/write data back from/to master endpoint.[1] PTYs are similar to bidirectional pipes.[3]: 1388 

Devpts is a Linux kernel virtual file system containing pseudoterminal devices.

Linux implementation is based on System V-style terminals (commonly referred as UNIX 98 pseudoterminals)[4] and provides POSIX and the Single Unix Specification API in the form of a posix_openpt() function since 1998.[5]

  1. ^ a b c "Pseudoterminal files". www.ibm.com. 2016-02-12. Retrieved 2021-09-30.
  2. ^ "Chapter 64: Pseudoterminals - The Linux Programming Interface [Book]". www.oreilly.com. Retrieved 2021-09-30.
  3. ^ a b c Kerrisk, Michael (2010). The Linux programming interface : a Linux and UNIX system programming handbook. San Francisco: No Starch Press. ISBN 978-1-59327-291-3. OCLC 728672600.
  4. ^ "pty(7) - Linux manual page". man7.org. Retrieved 2021-09-30.
  5. ^ posix_openpt – System Interfaces Reference, The Single UNIX Specification, Version 4 from The Open Group