The Terminal

The terms "terminal" and "terminal emulator" mean the same thing, so we'll use the shorter one from now on. The terminal is an application that you use to interface with your shell. That's it. I bet you've used one before: Terminal.app, Ghostty, iTerm2, Alacritty, Windows Terminal, etc.

It doesn't matter which one you choose. Some are plain and boring, some are more visually appealing with extra bells and whistles. But in the end, they all boil down to the same, basic functionality: type commands to your shell, render output, repeat.

The terminal handles input and output; the shell runs commands. The terminal sends echo hello to the shell, which returns hello.

What terminals do provide, however, is convenience in the form of tabs, windows, horizontal/vertical splitting, smoother/high-framerate text rendering, cool special effects when you type, etc. So like many things, everyone has their own personal preferences when it comes to choosing a terminal. When you open a new window or tab in your terminal, it will typically run your shell program for you, leaving you at its command prompt.

Back in the day, OG software engineers had to walk up to shared terminals (keyboard/monitor) in order to interface with the larger, mainframe computer. Today, we "emulate" this by using a terminal application to interface with local and remote computers.

The Shell

The shell is just a program. In fact, when you open up a new window or tab in your terminal, it runs yet another instance of your shell program. Five tabs open in your terminal? Five separate shell processes are running.

The shell provides a command-line interface (CLI) to your operating system. You type commands, the shell interprets them, makes any necessary system calls, and then outputs to your terminal. I'll cover system calls and the kernel in a separate post, but know that the shell's CLI abstracts away that lower-level complexity by allowing you to just type commands.

The shell interprets a command and launches the ls program. The program requests kernel services through system calls and receives results; the kernel manages system resources.
Here, ls makes system calls; the shell can make them directly too.

Like terminals, there's a lot of shells to choose from these days. I'm certain you've come across some of the more common ones: sh, bash, zsh.

Whichever you fall in love with, just know that bash is the de facto standard shell for the last 30+ years, so you cannot avoid it. zsh has been the default on macOS for a few years, but they continue to keep bash around because there's 30+ years of bash scripts in existence.

But remember that a shell is just a program. So if you wanted to use a newer, data-focused shell like Nushell, there's nothing stopping you from installing and running multiple shells. Your terminal might even make that easy for you with profiles; in one profile you can default to bash, and in another nushell when doing analysis. Use the best tool for the job!