ANSI escape sequences are characters embedded in the text used to control formatting, color, and other output options on video text terminals. Almost all terminal emulators designed to show text output from a remote computer, and (except for Windows) to show text output from local software, interpret at least some of the ANSI escape sequences.
Almost all manufacturers of video terminals added vendor-specific escape sequences to do operations such as placing the cursor at arbitrary positions on the screen. As these sequences were all different, elaborate libraries such as termcap were created so programs could use the same API for all of them. Another problem was that most designs required sending numbers (such as row & column) as the binary values of the characters, for some programming languages and for systems that did not use ASCII internally this was often difficult or impossible.
The first standard for ANSI escape sequences was ECMA-48, adopted in 1976. It was a continuation of a series of character coding standards, the first one being ECMA-6 from 1961, a 6 bit standard from which ASCII originates. ECMA-48 has been updated several times and the current edition is the 5th from 1991. It is also adopted by ISO and IEC as standard ISO/IEC 6429. The name ANSI escape sequence dates from the years 1981 to 1997, but in 1981 ANSI adopted ECMA-48 as the standard ANSI X3.64 (and later, in 1997, withdrew it).
The first popular video terminal to support these sequences was the Zenith Z19 in 1977. Far more influential was the Digital VT100 introduced in 1978. The popularity of these gradually led to more and more software, especially bulletin board systems, into assuming the escape sequences worked, leading to almost all new terminals and emulator programs supporting them.
Most terminal emulators running on Unix-like systems (such as xterm and the OS X Terminal) interpret ANSI escape sequences. The native text console in Linux (the text seen when X is not running) also interprets them. Terminal programs for Microsoft Windows designed to show text from an outside source (a serial port, modem, or socket) also interpret them. Some support for text from local programs on Windows is offered through alternate command processors such as JP Software's 4NT, Michael J. Mefford's ANSI.COM, and Jason Hood's ansicon.
Full article ▸