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

read the transcript!
The “terminal” is actually a bunch of components that work together.
Let’s imagine that you’re running python3 blah.py
.
Illustration of a flow chart. It begins with a smiling stick figure with curly hair, labelled “you”. Arrows leading away from “you” are labelled “keyboard shortcuts”, “type”, and “click”.
The arrows lead to a little character with a winky cursor face, labelled “terminal emulator: xterm, iTerm, GNOME terminal”.
In the middle of the diagram are two boxes, PTMX, and TTY. Between the two of them is the OS terminal driver (“Linux, Mac OS”).
There are arrows labelled “bytes” going between the terminal emulator and the OS terminal driver, and between the OS terminal driver and the programs on the far right.
The programs (“cat, vim, top, bash”) are represented by two box with smiley faces, labelled “shell” and “python”.
the terminal emulator
your terminal emulator is a translator:
- it translates all your typing/clicks into bytes
- and it takes all the bytes the program sends and displays them on the screen
the terminal driver
the terminal driver is part of your operating system. It’s in charge of sending signals to Python when you press Ctrl+C
, and some other more obscure things.
(more on page 24)
the shell
the shell is a special program which you use to start all other programs
The shell doesn’t do much after a program has started. Programs get a copy of the shell’s current directory, environment variables, and input/outputs, etc and then they’re on their own.
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!