Unspoken Rules of Terminal Programs: A 20-Year Retrospective

2024-12-12

This article summarizes the author's 20 years of experience with terminal programs, distilling common, albeit unofficial, 'rules' of behavior. These rules cover program responses to Ctrl-C, Ctrl-D, and the 'q' key, color usage, readline keybinding support, and pipe output. The author notes that while not mandatory standards, understanding these rules helps predict terminal program behavior and reduces the learning curve. The article uses examples to analyze the applicability and exceptions to these rules, emphasizing the importance of distinguishing between a program's own responsibility and default OS behavior.