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

read the transcript!
a program’s input and outputs are streams of bytes
everything you type goes into standard input (almost)
Illustration of a program, represented by a big box with a smiley face. There is an “in” arrow going into it, and “1 out” and “2 ERR” arrows coming out of it.
all the output you see comes from either standard output or standard error
your terminal emulator can only communicate with programs by reading/writing bytes
some inputs/outputs are text and some are special instructions
in: mouse position, ctrl+left arrow
out: make text green, make cursor invisible
these special instructions are called “escape codes”
they’re called “escape codes” because they all start with the ESC character
five ways people print out ESC
:
- \033
- ^[
- ESC
- \e
- \x1b
example: how colours get set
program: “^[[31m
”
Terminal emulator, represented by a box wth little arms and legs and a cute cursor winking face: “ok, I’ll make text red from now on!!”
(there are also codes for bold, underline, background colour)
programs can easily “break” your terminal by printing escape codes
program, represented by a frowning rectangle: “oops I made your cursor disappear”
It’s easy to fix though, run reset
to print a special escape code that resets everything
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!