Skip to content

Terminal Internals

Terminals are the primary interface for DevOps work, yet most engineers treat them as a black box. Understanding PTYs, TTYs, escape sequences, and signal delivery explains why SSH sessions hang, why Ctrl-C sometimes fails, and how tools like tmux multiplex your shell.

Why this matters

When a remote session freezes, a script produces garbled output, or a process ignores Ctrl-C, the root cause almost always lives in the terminal layer. Understanding this layer turns "reboot and hope" into a targeted fix.

Key concepts covered

  • TTY vs PTY: the difference between hardware terminals and pseudo-terminals
  • Escape sequences: how colors, cursor movement, and alternate screens work
  • Signal delivery: how Ctrl-C, Ctrl-Z, and SIGHUP flow through the terminal driver
  • Job control: foreground/background processes, process groups, and session leaders

Contents

Start with the primer for the conceptual foundation, then explore misconceptions and practical techniques.

# File What it covers
1 Primer TTY subsystem, PTY allocation, escape sequences, and the terminal-shell-process stack
2 Anti-Primer Myths about terminals — what "terminal" actually means vs what people assume
3 Footguns & Pitfalls Broken pipes, zombie sessions, TERM variable mismatches, and signal delivery surprises
4 Street Ops Diagnosing hung sessions, resetting corrupted terminals, and inspecting PTY state
5 Trivia & Interesting Facts Historical context from teletypes to modern terminal emulators