>_How the Terminal Works · Lesson 5 of 7
Colors, Cursors & Full-Screen Apps
Terminals only move bytes — so how does text turn green? How does vim own the whole screen? Answer: some bytes are secret commands. Escape codes are the terminal's hidden control language.
Beyond colors, escape codes move the cursor to any row and column, clear regions, and switch screens. Progress bars are 'carriage return, redraw the line'. Spinners are 'print, back up, print'. Full-screen apps — vim, htop, top — are programs furiously emitting cursor-movement and redraw codes while reading your keys raw. The terminal is a canvas addressed by text.
◆ Note
Ctrl+C isn't 'copy' here for a reason older than clipboards: the TTY layer turns it into a SIGINT signal that interrupts the running program. Ctrl+Z suspends (SIGTSTP; resume with fg), Ctrl+D sends 'end of input'. That's also why terminal copy/paste grew different bindings (Ctrl+Shift+C or Cmd+C).
Ctrl+C isn't 'copy' here for a reason older than clipboards: the TTY layer turns it into a SIGINT signal that interrupts the running program. Ctrl+Z suspends (SIGTSTP; resume with fg), Ctrl+D sends 'end of input'. That's also why terminal copy/paste grew different bindings (Ctrl+Shift+C or Cmd+C).