Text terminal
From Wikipedia, the free encyclopedia
A text terminal, or often just terminal (sometimes text console) is a serial computer interface for text entry and display. Original text terminals were electronic computer terminals connected to computers by a serial line, but later computers have built-in system consoles, and terminal emulator programs that work in a graphical desktop environment. Graphical displays have not eradicated the text terminal as it is convenient for computer programmers and appropriate for command-line interfaces and text user interfaces. Most programming languages support standard streams for inputting and printing text, and it is simplest to connect the streams to a text terminal.
Contents |
[edit] Types of text terminals
At first in the history of computers, teleprinters were used. Later, computer terminals developed to have video displays.
System console is a text terminal used to operate a computer. Modern computers have a built-in keyboard and display for the console. Some operating systems such as Linux and FreeBSD have virtual consoles to provide several text terminals on a single computer.
A terminal emulator is a computer program in a graphical windowing system that lets the user operate a text terminal in a window. This lets text terminals coexist with modern graphical user interfaces. Popular terminal emulators include Win32 console and xterm.
There are also specialized terminal emulators such as those used with modems. PuTTY is a terminal emulator and ssh client.
[edit] Applications running on a text terminal
The fundamental type of application running on a text terminal is a command line interpreter or shell, which prompts for commands from the user and executes each command after a press of Enter. This includes Unix shells and some interactive programming environments. In a shell, most of the commands are small applications themselves.
Another important application type is text editor. It occupies the whole area of display, shows a text document, and allows the user to edit the document. This has in part been replaced by word processors. First word processors used text to communicate the structure of the document, but later work outside of the text terminal and simulate the final paper document in a graphical user interface.
Programs such as Telix and Minicom control a modem and the local terminal to let the user interact with remote servers. In the Internet, telnet and ssh work similarly.
[edit] Programming interface
In the simplest form, a text terminal is like a file. Writing to the file displays the text and reading from the file produces what the user enters. In unix-like operating systems, there are several character special files that correspond to available text terminals. These include virtual consoles /dev/tty1 etc., serial ports /dev/ttyS0 etc. and pseudo terminals /dev/pts0 etc. There are also special files /dev/console, /dev/tty and /dev/tty0. Virtual consoles, computer terminals and modem lines can be configured in the file /etc/inittab read by init -- typically it starts the text mode login process getty for several virtual consoles.
The programs used to control the device files include setserial, setterm and stty. The command tty tells the name of the text terminal that it is run on.
For other operations, there are special escape sequences, control characters and termios
functions that a program can use, most easily via a library such as ncurses. For more complex operations, the programs can use terminal specific ioctl system calls.
[edit] External links
- Text Terminal HOWTO
- Terminal virus simulator - an eye candy demo in the style of an old-school green screen dumb terminal. Runable on IBM PC compatible