Glossary

Terms as this curriculum uses them. Where a word is commonly used loosely, the precise sense is given and the loose sense is named as such.


A

Alternate screen — A second, independent grid with no scrollback, switched to by DEC private mode ?1049 (or the older ?47/?1047). Full-screen programs use it so the user's shell session reappears untouched on exit. See Modes.

ANSI escape sequence — Loosely, any ESC-introduced control sequence. Precisely, the family standardized as ECMA-48 / ANSI X3.64, plus DEC private extensions, plus xterm extensions, plus de-facto behavior. There is no single authority; that is why terminfo exists.

Application cursor keys — See DECCKM.

Ascent — The distance from the baseline up to the top of the tallest glyph. From the font's hhea table. See Fonts.

Async-signal-safe — A function that may legally be called from a signal handler. write, _exit, and sigaction are; malloc, printf, and anything taking a lock are not. Violating this produces rare, undebuggable deadlocks.


B

Baseline — The line glyphs sit on. baseline_y = cell_top + ascent. Drawing at the cell top instead clips every descender.

Bracketed paste — DEC private mode ?2004. Pasted text is wrapped in CSI 200~ … CSI 201~ so programs can distinguish pasting from typing. Fixes editor auto-indent staircases.

BS — Backspace, byte 0x08. Moves the cursor left; does not erase. The visual erase you see is BS SP BS.


C

C0 controls — Bytes 0x00–0x1F. Executed immediately in any parser state.

C1 controls — Bytes 0x80–0x9F in an 8-bit environment. In UTF-8 mode these are continuation bytes and must not be honored as controls — doing so corrupts non-ASCII text.

Canonical mode — Line-buffered input. ICANON set: the line discipline buffers a line, handles VERASE/VKILL editing, and releases it to read() only on a line terminator. Contrast raw mode.

Cell — One character position in the grid: a grapheme, a style, and a width. Must be small and Copy; an 80×24 screen holds 1,920 of them.

ConPTY — Windows' pseudoconsole. A user-space service (conhost.exe) translating between VT sequences and the Win32 Console API — architecturally unlike a Unix PTY, which is a kernel object. See Platform Notes.

Controlling terminal — The terminal associated with a session. Acquired by a session leader with none, via ioctl(fd, TIOCSCTTY, 0). Terminal-generated signals go to its foreground process group. Reachable as /dev/tty.

CR — Carriage return, byte 0x0D. Moves to column 0. The Enter key sends CR, not LF.

CSI — Control Sequence Introducer: ESC [ (0x1B 0x5B). The introducer for the numeric-parameter sequence family. See The CSI Catalog.


D

Damage — The set of rows changed since the last render. Row granularity is right for a terminal. Cursor movement damages two rows; forgetting the old one leaves a ghost cursor.

DCS — Device Control String: ESC P. Carries large payloads (sixel images, terminfo queries). Streamed via hook/put/unhook because payloads can be megabytes.

DECAWM — DEC Auto Wrap Mode, ?7, set by default. When reset, text at the last column overwrites in place instead of wrapping.

DECCKM — DEC Cursor Key Mode, ?1. When set, arrows send SS3 A instead of CSI A. The program sets it; the terminal obeys. This is why arrows differ between bash and vim.

DECOM — DEC Origin Mode, ?6. Cursor positioning becomes relative to the scroll region.

DECSTBM — Set Top and Bottom Margins, CSI Pt;Pb r. Defines the scroll region. Homes the cursor. How top keeps its header and vim keeps its status line.

DECTCEM — Text Cursor Enable Mode, ?25, set by default. Cursor visibility.

Descent — The distance from the baseline down to the lowest glyph. Stored negative in font tables; cell_height = ascent - descent + line_gap.

devpts — The Linux filesystem providing /dev/pts/N slave devices, created dynamically. macOS uses static /dev/ttysNNN nodes instead.


E

ECHO — termios c_lflag flag. When set, the kernel copies input bytes to the output side. This is why you see what you type — the shell is not involved.

EIO — The error read() on a PTY master returns on Linux after the last slave closes. It is the EOF condition, not an error. macOS returns 0 instead.

Escape ambiguity — ESC alone and the first byte of ESC [ A are identical. Resolved by a timeout (25–50 ms). Why Escape can feel laggy over SSH; removed by the kitty keyboard protocol.


F

Foreground process group — The one process group of a terminal that receives terminal-generated signals (SIGINT, SIGTSTP, SIGWINCH). Set by the shell with tcsetpgrp. Shown as TPGID in ps.


G

Glyph atlas — A cache of rasterized glyphs, keyed by (char, size, bold, italic). Omitting style from the key renders everything in whichever style was cached first.

Golden test — A recorded byte stream plus a checked-in expected snapshot. Catches regressions in whole-stream behavior. See Golden and Differential Tests.

Grapheme cluster — What a user perceives as one character; may be several codepoints (e + ◌́, or a seven-codepoint ZWJ family emoji).


H

HT — Horizontal tab, byte 0x09. Moves to the next tab stop. Must not wrap.

Hyperlink (OSC 8) — OSC 8 ; params ; URI ST text OSC 8 ; ; ST. Stored interned — a u16 id in the cell, not the URI — so Style stays small.


I

ICRNL — termios input flag translating CR → NL. Why pressing Enter (which sends CR) gives a program \n.

ISIG — termios flag enabling signal generation from VINTR/VQUIT/VSUSP. Cleared in raw mode, which is why Ctrl+C is data in vim.

IXON — Software flow control. ^S pauses output, ^Q resumes. Why ^S appears to freeze a terminal.


L

LF — Line feed, byte 0x0A. Moves down, not to column 0. ONLCR adds the CR on output.

Line discipline — Kernel code between a terminal device and the reading process. Implements echo, canonical buffering, signal generation, and CR/LF translation. Configured through termios. Linux's is N_TTY. The same code serves serial ports, virtual consoles, and PTYs.


M

Master (PTY) — The end held by the terminal emulator or multiplexer. Has no device file and can never be a controlling terminal. It replaces the hardware in the 1970 picture.

modifyOtherKeys — xterm's CSI > 4 ; 2 m extension, encoding key combinations the legacy protocol cannot express (Ctrl+1, Ctrl+Shift+A).

Multiplexer — A user-space program holding many PTY masters, running a headless terminal emulator per pane, compositing them, and outliving its own UI. tmux, screen, zellij. Not a terminal emulator; it contains several.


O

ONLCR — termios output flag translating NL → CR NL. Why a program can print "\n" and get a proper newline — and why raw-mode output stair-steps when it is cleared.

OSC — Operating System Command: ESC ]. Carries strings: titles, colors, hyperlinks, clipboard, working directory, semantic prompts. Terminated by BEL or ESC \.

Overstrike — Bold via X BS X, and underline via _ BS X. Predates SGR by decades. man still uses it; without support, man pages render as NNAAMMEE.


P

Pending wrap — The deferred-wrap flag. Writing to the last column does not move the cursor; it sets this flag, and the wrap happens when the next printable character arrives. Omitting it inserts a blank line after every full-width line. The most visible screen-model bug.

Process group — A set of processes signalled as a unit; one job. Created with setpgid.

PTY — Pseudo-terminal. A kernel-provided pair: a master (a plain fd) and a slave (a device file that behaves exactly like a TTY, line discipline included). The master end replaces the hardware.


R

Raw mode — Not a single flag but a set: ICANON, ECHO, ISIG, IEXTEN, OPOST, ICRNL, and IXON cleared. cfmakeraw() does it — but does not set VMIN/VTIME, which you must.

Render model — A renderer-independent description of the screen: styled runs, resolved colors, cursor, damage. Speaks in cells, never pixels. The boundary that lets you swap CPU for GPU.


S

Scrollback — Lines evicted from the top of the primary grid. A VecDeque, bounded. The alternate screen has none. Sub-region scrolls do not contribute.

Scroll region — Rows between the DECSTBM margins. LF at the bottom scrolls the region, not the screen.

Session — A collection of process groups, created by setsid(). Has one session leader and at most one controlling terminal. The unit that receives SIGHUP.

SGR — Select Graphic Rendition, CSI Pm m. Carries every visual attribute and all three color models. The most frequently emitted escape sequence in existence.

SIGHUP — Sent by the kernel to the session leader when the terminal's last master fd closes. Why closing a window kills everything, and why nohup, disown, and tmux exist.

SIGWINCH — Sent to the terminal's foreground process group when TIOCSWINSZ changes the size. Default disposition: ignored, which is why resize-unaware programs keep running badly.

Slave (PTY) — The end the child holds as fds 0/1/2. A device file (/dev/pts/N or /dev/ttysNNN). Can be a controlling terminal.

Spacer — The second cell of a double-width character. Holds no character of its own. Invariant: every wide cell is followed by exactly one spacer, and every spacer is preceded by a wide cell.

Split-input property — Feeding a byte stream one byte at a time must produce identical results to feeding it all at once. Only a real state machine has it. Its absence causes intermittent corruption over SSH.

SS3 — Single Shift 3: ESC O. Introduces application-mode cursor keys and F1–F4.

ST — String Terminator: ESC \ (7-bit) or 0x9C (8-bit — do not honor in UTF-8). OSC also accepts BEL.


T

termios — The structure configuring the line discipline: c_iflag, c_oflag, c_cflag, c_lflag, and c_cc[]. One per PTY pair, reachable from either fd.

terminfo — A database of terminal capabilities, keyed by $TERM. Exists because escape sequences are a family of overlapping conventions rather than one standard.

TIOCGWINSZ / TIOCSWINSZ — ioctls to get and set struct winsize. Setting sends SIGWINCH. Never hardcode their numeric values — they differ by platform and architecture.

TIOCSCTTY — The ioctl acquiring a controlling terminal. Requires being a session leader with none. Must come after setsid().

TPGID — The ps column showing the terminal's foreground process group. TPGID == PGID means that process is in the foreground.

Truecolor — 24-bit color: SGR 38;2;r;g;b (semicolon) or SGR 38:2::r:g:b (colon, the standard form). Both are in the wild; support both.

TTY — A character device with a line discipline. Originally a teletypewriter on a serial line. Every strange thing about terminals traces back to that.


V

VMIN / VTIME — Non-canonical read control. VMIN=1, VTIME=0 blocks until at least one byte. cfmakeraw does not set them; forgetting causes a 100%-CPU spin.


W

Wide character — A codepoint of East Asian Wide or Fullwidth property, occupying two cells. Most CJK and emoji.

winsize — struct { ws_row, ws_col, ws_xpixel, ws_ypixel }. The kernel stores it and never reads it; it is a mailbox with a doorbell (SIGWINCH).

Wrapped flag — Per-line: did this line end by wrapping or by an explicit newline? Needed for copy/paste (join wrapped lines) and reflow. One bit; the difference between a usable terminal and an annoying one.


See also: Reference Overview · Escape Sequence Cheat Sheet · termios Cheat Sheet · Key Encoding Table · Primary Sources · The Terminal Ecosystem