About

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 Microsoft Windows) to show text output from local software, interpret at least some of the ANSI escape sequences.

UNIX

Most terminal emulators running on Unix-like systems (such as xterm and the OS X Terminal) interpret ANSI escape sequences. The Linux console (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 TCC (formerly 4NT), Michael J. Mefford's ANSI.COM, and Jason Hood's ansicon. Many Unix console applications (e.g., ls, grep, Vim, and Emacs) can generate them. Utility programs such as tput output them, as well as in low-level programming libraries, such as termcap or terminfo, or a higher-level library such as curses.

Windows and DOS

MS-DOS 1.0 did not support the ANSI or any other escape sequences. Only a few control characters (CR, LF, BS) were interpreted, making it impossible to do any kind of full-screen application. Any display effects had to be done with BIOS calls (or far more often by directly manipulating the IBM PC hardware).

MS-DOS 2.0 introduced the ability to add a device driver for the ANSI escape sequences – the de facto standard being ANSI.SYS, but others like ANSI.COM, and NANSI.SYS are used as well. Extreme slowness and the fact that it was not installed by default made usage by software almost non-existent; software continued to directly manipulate the hardware to get the text display needed. ANSI.SYS and similar drivers continued to work in through Windows 98, and even in Windows Me, when they were set to native DOS mode (the characters taking the whole screen). ANSI.SYS also worked in NT-derived systems for 16-bit legacy programs executing under the NTVDM.

The Win32 console does not support ANSI escape sequences at all. Software can manipulate the console with the ioctl-like Console API interlaced with the text output. Some software internally interprets ANSI escape sequences in text being printing and translates them to these calls[citation needed].

history | show excerpt | excerpt history