Skip to Content
Navigation:

A stick figure smiling

This is a page from an upcoming zine called "The Secret Rules of the Terminal".

To get an email when the zine comes out, sign up for the zine announcements list!

Image of a comic. To read the full HTML alt text, click "read the transcript".
read the transcript!

editing text in a REPL doesn’t always work

little stick figure, horrified: when I press my ARROW KEYS it just prints out [[D??? what?

this is because every program has fo implement text editing itself

terminal program author, represented by a nonplussed looking stick figure with medium length straight hair, thinking: but I just want arrow keys to work?? shouldn’t that be automatic?

unix, represented by a box with a smiley face: NOPE you gotta do it

you do gef a few things automatically

  • backspace (occasionally backspace won’t work and you have to use Ctrl+H instead)
  • Ctrl+W (delete word)
  • Ctrl+U (delete line)

(see page 25 for what “automatically” means)

REPLs mostly have the same keyboard shortcuts

there’s a very popular library called “readline”, and everyone either uses it or imitates how it works

for example Ctrl+A (“go to beginning of line”) comes from readline

rlwrap adds readline keyboard shortcuts

for example on my machine the dash shell doesn’t use readline but you can make it better by running:

rlwrap dash

built in programs on Mac don’t use readline

(for example sq1ite3)

this is probably because readline is GPL licensed

They use libedit which is worse. I like to install a sqlite version with readline support and use that instead.

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2025 | All rights reserved (see the FAQ for notes about licensing)