A Linux terminal has a lot more features than the TeleType of yore. On a TeleType, text spews out and scrolls up and is gone forever. A real terminal can use escape characters to do navigate around and emulate most of what you like about GUIs. However, doing this at the lowest level is a chore and limits portability. Luckily, all the hard work has already been done.
First, there’s a large database of terminal capabilities available for you to use:
terminfo. And in addition, there’s a high-level library called
ncurses that simplifies writing programs to control the terminal display. Digging deep into every nook and cranny of
ncurses could take years. Instead, I’m going to talk about using a program that comes with
ncurses to control the terminal, called
tput. Using these two commands, you can figure out what kind of terminal you’re dealing with, and then manipulate it nearly to your heart’s content. Let’s get started!