2026-09-02
Link: https://emmajuettner.com/posts/when-the-shell-breaks-your-arrow-keys/
HN Discussion: 1 points, 0 comments
Every developer who has ever SSH'd into a minimal container, dropped into a recovery shell, or fired up sh instead of bash has hit the same infuriating wall: you press the up arrow expecting your last command, and instead the terminal spits out ^[[A. You press left to fix a typo and get ^[[D. Then you sheepishly retype the whole line.
This post looks like it actually explains why that happens — which is a rabbit hole that goes surprisingly deep. The short answer touches on:
[A, [B, [C, [D. The terminal emulator agreed on this convention decades ago via ANSI/VT100.sh (dash, ash, busybox sh) often has no line editor at all, so the raw sequence just gets echoed.$TERM — if the terminal identifies itself as something the remote system doesn't have a terminfo entry for (hello, TERM=xterm-kitty on an old Alpine box), key bindings silently break.rlwrap sqlite3, rlwrap python2, rlwrap sh) and you get history, editing, and completion for free.This is exactly the kind of foundational plumbing knowledge that everyone touches but almost nobody sits down to actually learn. It's one of those articles where after reading it, a dozen unrelated frustrations across your career suddenly click into place — why docker exec -it alpine sh is miserable, why your Dockerfile's RUN steps behave oddly, why ssh into a stripped-down box feels time-warped to 1985.
Emma Juettner's blog has a track record of taking small "wait, why does that happen?" observations and unpacking them with genuine curiosity rather than the surface-level answer. This slipped through with a single upvote and no comments, which is a shame — it's the kind of post that should live in a bookmark folder titled "explain this to the junior next week."
