DEV Community

Jini
Jini

Posted on

The Relationship Between the Terminal, CLI, Shell, and the Kernel

Lately, I've been refreshing my memory on Operating Systems, their different parts, and functions. I became confused about the exact difference between a terminal and a Command Line Interface (CLI). This entire time I've been thinking they're the same thing but turns out they're not 😬

After doing some research, I was able to understand the clear distinction between the two. I've found the analogy below helpful in making that distinction.

Analogy

You go into a restaurant and notice they have various tablets lined up at the counter for you to place your order. Each provides a UI displaying the restaurant's menu as a set of selectable options. You go towards one, select a food category, choose an item, and place your order.

The restaurant's software system then translates all your selections into a structured ticket that prints out for the kitchen staff to read and prepare your order.

Metaphor Breakdown

You = User who is inputing a request

Tablet = Terminal
The environment/interface where the interaction happens between you (user) and the kitchen staff (kernel).

Menu = CLI
The method of communication that allows you to input a set of commands (selectable options) to interact with the kitchen.

Restaurant's software system = Shell
A program that translates your input into a format that the kitchen staff can better understand.

Kitchen = Kernel
The heart of the restaurant, which receives the "translated" order and executes it.

Technical Explanation

When a user opens a terminal window, it starts a shell program, which provides the user with a CLI: a text-based method of interaction that allows the user to run a set of commands.

The user then enters text-based commands → the shell translates them into a format that the kernel understands → sends them to the kernel → kernel executes them → the result/output is displayed in the terminal window.

These components are interconnected, but they all play a unique role in providing us with a simple way of interacting with our computer's hardware.

Top comments (0)