The author explores how interactive CLI tools like less and fzf can receive piped stdin while still reading keyboard input, revealing the Unix file descriptor mechanics behind pipelines. Through a multi-stage piped experiment, the article explains how each process knows its position, accesses the terminal separately, and avoids competing for input simultaneously.
Background
Unix pipelines connect processes by wiring each process's stdout to the next process's stdin via file descriptors. Interactive programs in pipelines must access the terminal independently (often via /dev/tty) to remain responsive to keyboard input.
- Source
- Lobsters
- Published
- Aug 20, 2026 at 06:10 AM
- Score
- 5.0 / 10