Chapter 9: Terminal I/O and Changing Terminal Behavior
In this chapter, we learn what a TTY (short for TeleTYpewriter) and a PTY (short for Pseudo-TeletYpewriter) are and how to get information about them. We also learn how to set their attributes. Then, we write a small program that takes input without echoing the text—perfect for a password prompt. We also write a program that checks the size of the current terminal.
A terminal can take many forms—for example, a terminal window in X (the graphical frontend); the seven terminals accessed with Ctrl + Alt + F1 through F7; an old serial terminal; a dial-up terminal; or a remote terminal such as Secure Shell (SSH).
A TTY is a hardware terminal, such as the consoles accessed with Ctrl + Alt +
Get Linux System Programming Techniques now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.