Prologue: Staring at the Black Screen
When I first started coding on my MacBook, I installed something called iTerm2. A black window with green text. I'd type commands and things would happen. People called it a "terminal."
But it felt weird. Why are we using this retro-looking interface in 2025? Why text when we have GUI? And occasionally I'd see paths like /dev/tty or /dev/pts/3. What were those?
Even more confusing: people used "terminal," "console," and "shell" interchangeably. Nobody explained the difference.
So I dug in. I had to figure out what this black screen really was.
Struggle: Drowning in Terminology
At first I thought it'd be simple. "Terminal = black screen." But the more I researched, the more terms kept popping up:
- Terminal
- TTY (Teletype)
- PTY (Pseudo-Terminal)
- Console
- Shell
- Terminal Emulator
I had no idea what was what. Then I stumbled upon a StackOverflow comment:
"You're not using a terminal. You're using a terminal emulator. Real terminals were hardware."
Emulator? So iTerm2 was simulating something?
Aha Moment: Traveling Back to the 1960s
That's when it clicked. This was about history.
In the 1960s, computers were room-sized with no monitors. Instead, people used Teletypewriters (TTY)—machines that looked like typewriters. You'd type on them, and characters would travel through wires to a distant mainframe. The computer would send responses back, and the TTY would print them on paper.
The typewriter was the terminal.
By the 1970s, physical terminals like the VT100 replaced paper with CRT monitors. Still hardware, but now characters appeared on a screen. These terminals understood ANSI escape codes—special character sequences. For example, \033[31m would turn text red.
# ANSI escape code examples
echo -e "\033[31mRed text\033[0m"
echo -e "\033[1;32mBold green\033[0m"
echo -e "\033[4;34mUnderlined blue\033[0m"
Run this in your terminal and colors change. Why? Because 1970s VT100 terminals were designed that way. And programs like iTerm2, Windows Terminal, and Alacritty all simulate VT100 behavior in software. That's why they're called Terminal Emulators.
Suddenly everything made sense. iTerm2 on my MacBook was simulating 1970s hardware. Like playing Super Mario on a Nintendo emulator, I was recreating a 50-year-old typewriter experience.
Deep Dive: TTY, PTY, and the /dev Universe
What is TTY and /dev/tty?
In Linux, typing tty gives you something like this:
$ tty
/dev/pts/3
What is /dev/pts/3? It's a PTY (Pseudo-Terminal) device file. Linux treats everything as files, including terminals.
/dev/tty: Points to the terminal connected to the current process (like a symlink)/dev/pts/N: Pseudo-terminals created in GUI environments/dev/ttyN: Physical consoles or serial ports (like the text console you get with Ctrl+Alt+F2)
PTY Master/Slave Architecture
When you launch a terminal emulator in a GUI (macOS, Windows, GNOME), this happens:
- The emulator (iTerm2) asks the OS: "Create a fake terminal for me"
- OS creates a PTY Master and PTY Slave pair
- The emulator connects to PTY Master, receives user input, and displays output
- The shell (bash, zsh) connects to PTY Slave, reads commands, and writes results
Metaphor: The emulator is a "switchboard operator," the shell is a "customer service agent." When you speak, the operator relays it to the agent. When the agent responds, the operator relays it back. PTY is the phone line connecting them.
stty: Terminal Settings Control
The stty command configures terminal behavior:
# View current terminal settings
$ stty -a
# Hide password input (disable echo)
$ stty -echo
$ read password
$ stty echo
# Check terminal size
$ stty size
50 180
These settings date back to hardware terminal days. For example, the erase setting defines what character the backspace key sends—because old terminals sent either ^H or ^? depending on the model.
tty Command in Action
The tty command tells you which terminal device your process is connected to:
# In iTerm2
$ tty
/dev/pts/3
# In a different tab
$ tty
/dev/pts/4
# In a cron job or non-interactive script
$ tty
not a tty
This reveals whether you're in an interactive terminal session or running in the background.
Application: TTY/PTY in the Real World
SSH and PTY Allocation
When using SSH, you might see the -t option:
ssh -t user@server sudo vim /etc/hosts
The -t flag means "force PTY allocation." Why?
Some programs (vim, sudo, top) require an interactive terminal to work properly. Without a PTY, they'll error out with "stdin is not a tty."
Terminal Multiplexers: tmux and screen
Instead of opening multiple terminal windows, you can manage multiple sessions within one terminal using a terminal multiplexer like tmux or screen.
# Start tmux
$ tmux
# Create new window: Ctrl+b c
# Switch windows: Ctrl+b 0, Ctrl+b 1
# Split horizontally: Ctrl+b %
# Split vertically: Ctrl+b "
# Detach session (background): Ctrl+b d
# Reattach later
$ tmux attach
Metaphor: If your terminal emulator is a "house," tmux creates "rooms" inside it. You can move between rooms without leaving the house.
The killer feature: sessions survive SSH disconnections. If you're running a long task on a remote server and WiFi drops, just reconnect and type tmux attach—your work is still there.
Terminal vs Console vs Shell: Finally Understanding the Difference
Now we can clearly distinguish these three:
- Terminal: The input/output device or the software that simulates it. It only handles keyboard input and screen output. Examples: iTerm2, Windows Terminal, Alacritty.
- Console: The terminal physically connected to the server. Usually where boot messages and kernel logs appear. Represented by
/dev/console. - Shell: The program that executes commands. Examples: bash, zsh, fish. The terminal is just a window for text; the shell interprets and runs the commands.
Metaphor: Terminal is the "telephone," shell is the "person you're talking to," console is the "office main line."
Modern Terminal Emulators: The Era of GPU and AI
In recent years, terminal emulators have evolved dramatically. They've gone from simulating 50-year-old typewriters to incorporating GPU acceleration and AI features.
GPU-Accelerated Terminals: Alacritty, Kitty
Traditional terminal emulators (iTerm2, GNOME Terminal) render text with the CPU. Scrolling through massive logs can lag.
Alacritty and Kitty use OpenGL for GPU rendering. The result? Blazing speed. Tens of thousands of log lines scroll smoothly.
AI-Powered Terminal: Warp
Warp embeds AI directly into the terminal. Ask in natural language and it generates commands. Say "find files larger than 5MB" and it produces find . -size +5M.
Warp also treats command input as blocks. You can edit commands like in vim, and each command's output is neatly boxed.
Windows Terminal: Microsoft's Comeback
For decades, Windows had terrible terminals. cmd.exe felt like MS-DOS even in 2025. Then in 2019, Microsoft released Windows Terminal as open source.
- Tab support
- GPU acceleration
- Full Unicode and emoji support
- PowerShell, CMD, and WSL Bash all in one window
Windows users can now have an iTerm2-level experience.
Closing: Why 50-Year-Old Tech is Still the Best
The most surprising part of studying terminal history? The 50-year-old design is still relevant.
GUIs are intuitive and pretty. But for managing remote servers, writing scripts, or chaining complex commands, nothing beats text streams. You can't click your way to "find files modified last week, larger than 10MB, containing TODO comments." But in a terminal, it's one line:
find . -mtime -7 -size +10M -type f -exec grep -l "TODO" {} \;
That's why we still use black screens. Whether it's a Rust-based GPU-accelerated terminal or an AI-powered futuristic one, they're all emulating 1960s teletypes.
Technology advances, but fundamentals endure. Text as an interface. Files as abstraction. Pipes for composition. That's why they're still the best tools we have.