PTY (Pseudo-terminal)
A PTY, or pseudo-terminal, is a software terminal that the operating system provides, so that programs can run interactively as if a person typed at a keyboard.
A PTY, short for pseudo-terminal, is a terminal made in software. The operating system creates it as a pair of connected ends. A program, such as a shell, runs on one end and behaves as if it were connected to a real terminal. Another program, such as a terminal app or a remote session, reads and writes on the other end.
Many programs act differently when they run in a terminal. They show colors and progress bars, ask questions, and redraw the whole screen, as text editors do. Without a PTY, they may print plain output or refuse to run interactively. A PTY also carries the size of the window and signals, such as the one sent when a person presses Ctrl+C.
PTYs make remote and interactive sessions possible, such as SSH and terminals in a web browser. A sandbox can give a person or an agent a PTY to run an interactive shell inside it. The other end is sent over the network, so that the session works as if the sandbox were local. Agents use PTYs for programs that need a terminal, such as interactive installers or text editors.