Skip to Content
Navigation:

A stick figure smiling

If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

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

browse more comics! get the zine!
read the transcript!

editing text you typed in seems so basic:

>>> print("helo")

oops, forgot an l!

but there’s actually no standard system

programs need to implement even the most basic things

Illustration of a little smiling stick figure with curly hair.

person: “left arrow”

program, represented by a box with a smiley face: “ok I will move the cursor to the left”

often programs will use the readline library for this

option 1: NOTHING

person (angry): “even the ARROW KEYS don’t work???”

program (blissfully content): arrow keys? what’s that?

  • Only Ctrl-W Ctrl-U and backspace work
  • Examples: cat, nc, git
  • You’re probably in this situation if you press the left arrow key and it prints ^[[D
  • You can often add readline shortcuts with rlwrap, like this:

$ rlwrap nc

option 2: READLINE

person (neutral): “it’s a little awkward but at least I can use those weird keyboard shortcuts from emacs!”

  • LOTS of keyboard shortcuts: Ctrl-A Ctrl-E , arrow keys, many more
  • You can use Ctrl-R to look at history
  • Examples: bash, irb, psql
  • If you press Ctrl-R and you see “reverse-i-search” , you’re probably using readline
  • Configurable with the ~/.inputrc config file

option 3: CUSTOM

person (smiling): “wow, I can type a multiline command without it being a total disaster?? amazing!”

  • The keyboard shortcuts are probably influenced by readline
  • Examples: fish, zsh, ipython
  • usually you only see custom implementations in bigger projects

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 2024 | All rights reserved (see the FAQ for notes about licensing)