Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Terminal, Shell, and Kernel: What Is What?

The terminal is the window, the shell is the brain that understands your commands, and the kernel is the engine doing the real work — three separate pieces that people constantly confuse.


Why Learn This Distinction?

Most beginners say “I opened the terminal and typed a command” without realizing they actually used three different programs:

  • The terminal emulator drew the window and your keystrokes
  • The shell interpreted what you typed and handed it to the system
  • The kernel executed the work the shell requested

When a command “does not work”, knowing which layer broke is half the debugging. And when someone says “learn bash”, they mean the shell — not the terminal, and definitely not the kernel.

You can switch terminals freely; your shell and its configuration follow you. The kernel is invisible, but every single command you ever run passes through it.


1. The Kernel: The Invisible Engine

The kernel is the core program that owns the hardware. It decides which process gets CPU time, which program may read a file, and how data moves to disk and network cards.

┌──────────────────────────────────────┐
│  Your command:  ls -la /etc          │
└───────────────┬──────────────────────┘
                │
┌───────────────▼──────────────────────┐
│  Shell (bash): parses the command,   │
│  finds /bin/ls, starts a process     │
└───────────────┬──────────────────────┘
                │  system calls (open, read, write, ...)
┌───────────────▼──────────────────────┐
│  Kernel: reads the directory from    │
│  disk, checks permissions, returns   │
│  the raw data                        │
└───────────────┬──────────────────────┘
                │
┌───────────────▼──────────────────────┐
│  Hardware (disk, CPU, memory)        │
└──────────────────────────────────────┘

What the kernel actually does

  • Process management — starts, stops, and schedules every running program
  • Memory management — gives each process its own slice of RAM
  • Filesystem access — everything on disk is a file, and the kernel mediates all reads and writes
  • Device drivers — talks to graphics, USB, network hardware on your behalf
  • Network stack — handles sockets, TCP/IP, firewalls

The kernel is never “used” directly by normal programs — they request services through system calls, a controlled API.


2. The Shell: Your Command Interpreter

The shell is a program with a prompt. It reads the line you type, interprets it, and executes what you asked for. It is also a full programming language, which is why shell scripting is a core Linux skill.

The most common shells

ShellPrompt hintNotes
bash$“Bourne Again SHell” — the Linux default; what most tutorials assume
sh$The original POSIX shell; bash runs in sh compatibility mode
zsh%Superset of bash with better completion; macOS default since Catalina
fish>“Friendly interactive shell” — autosuggestions out of the box, not POSIX
ksh / csh$ / %Older shells, still found on legacy Unix systems

Check which shell you are using:

echo $SHELL
echo $0
/bin/bash
bash

What the shell does with your input

When you type ls -la /etc | head -5, the shell:

  1. Parses the line into the command ls and arguments -la /etc
  2. Expands shortcuts — ~ to your home directory, $USER to your username, * to matching filenames
  3. Finds the program — searches every directory in $PATH for an executable named ls
  4. Executes it — starts the process and waits
  5. Wires up pipes — connects ls’s output into head’s input
  6. Reports the exit code (0 for success) via $?

3. The Terminal: The Window You Type Into

The terminal emulator is a graphical program that displays a shell. It handles fonts, colors, copy/paste, tabs, and windows — but knows nothing about your commands.

Common terminal emulators

TerminalPlatformNotes
GNOME TerminalLinux (GNOME)Default on Ubuntu/Fedora desktop
KonsoleLinux (KDE)Default on KDE Plasma
Alacritty / KittyLinuxGPU-accelerated, config-file driven
Terminal.appmacOSBundled with macOS
iTerm2macOSPower-user favorite, heavily customizable
Windows TerminalWindowsRuns WSL shells, tabs, and themes
PuTTYWindowsOld-school SSH client

The same shell works in all of them. Switching from GNOME Terminal to Alacritty changes nothing about how commands behave.


4. How They Fit Together

Terminal emulator (window, keys, pixels)
   └── Shell (bash/zsh: parses & runs your commands)
          └── Kernel (executes the actual work)
                 └── Hardware

Example: start ssh on your laptop — the terminal window is local, the shell is local bash, and the kernel is your laptop’s. When ssh connects to a server, you get a remote shell on the remote kernel, still displayed in your local terminal.

That single line explains remote servers: nothing runs on your screen except a window; everything else happens on the other machine.


Common Pitfalls

  • “Terminal” and “shell” are not synonyms — if a script fails, the terminal is not the suspect; check the shell or the program itself.
  • GUI ≠ shell knowledge — clicking through a file manager teaches nothing about pipes, redirects, or scripting.
  • Changing shells does not lose your data — but bash and zsh config files differ (.bashrc vs .zshrc).
  • sh is not always a symlink to bash — on Debian/Ubuntu, /bin/sh is dash, which is faster but smaller; scripts with #!/bin/bash may behave differently under plain sh.

PageWhy it is related
What Is Linux?The kernel explained from the distribution side
Opening a TerminalHow to actually get to a shell on any system
Keyboard ShortcutsMake typing at the shell prompt faster

Terminal / Shell / Kernel Cheatsheet

TaskCommand / fact
Which shell am I in?echo $SHELL
Which shell is running me now?echo $0
List installed shellscat /etc/shells
Change your default shellchsh -s /bin/zsh
Shell config (bash)~/.bashrc
Shell config (zsh)~/.zshrc
Kernel versionuname -a
Terminal emulators on LinuxGNOME Terminal, Konsole, Alacritty, Kitty