
Here's a preview from my zine, The Secret Rules of the Terminal! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
different terminal emulators use different escape codes
terminal emulator 1: if you print out ESC[2J
I’ll clear the screen!
terminal emulator 2: for me it’s ESC[HESC[J
!
your system has a database called “terminfo” with escape codes in it
how if plays out when you press Ctrl+L
to clear the screen:
program, with a little heart over it, thinking:
ah, she wants fo clear the screen! I’ll look up how to do that in the terminfo database…
(on my machine, the database is in /usr/share/terminfo
)
program: ESC[HESC[J
terminal emulator, thinking: ok, clearing the screen!
how programs know what terminal you’re using: TERM
your terminal emulator sets the TERM
environment variable when it starts
fun fact: terminal emulators often say they’re “xterm-256color
” even if they’re not
this can break when SSHing into an old system with a new terminal emulator
(in a VERY annoying way)
happy little stick fiture: I am using ghostty
program, with a little heart over it: NOPE never heard of it
some ways to fix TERM
- install the terminfo file for your terminal emulator on the system
- use a different terminal emulator
- just set
TERM=xterm-256color
, it’ll often sort of work
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!